21-10-12, 01:12 PM
كاتب الموضوع : MrBassam
هذا مثال لانميشن بسيط بسطر واحدارجو ان يعجبكم
كود الـXAML
كود :
<Window x:Class="LearnWPF.AnimationInCode.Window1"
xmlns=" http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns:x=" http://schemas.microsoft.com/winfx/2006/xaml "
Title="LearnWPF.AnimationInCode"
Height="300" Width="300" Loaded="WindowLoaded"
>
<Button Name="myButton" Content="Hello" />
</Window>
كود :
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace LearnWPF.AnimationInCode
{
public partial class Window1 : System.Windows.Window
{
public Window1()
{
InitializeComponent();
}
void WindowLoaded(object sender, RoutedEventArgs e)
{
myButton.BeginAnimation(Button.HeightProperty,
new DoubleAnimation(25, 150, new Duration(new TimeSpan(0, 0, 1))));
}
}
}
كود :
Imports System.Windows.Media.Animation
Class Window1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
btnOne.BeginAnimation(Button.HeightProperty, New DoubleAnimation(25, 150, New Duration(New TimeSpan(0, 0, 1))))
End Sub
بالتوفيق