本文整理汇总了C#中System.Windows.Controls.Grid.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.BeginAnimation方法的具体用法?C# Grid.BeginAnimation怎么用?C# Grid.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.BeginAnimation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnimationUp
private void AnimationUp(Grid grid)
{
ThicknessAnimation ta = new ThicknessAnimation();
ta.From = grid.Margin;
ta.To = new Thickness(grid.Margin.Left, RowHeight + SpaceBetweenGrids, 0, 0);
ta.Duration = new Duration(TimeSpan.FromSeconds(0.5));
grid.BeginAnimation(Grid.MarginProperty, ta);
}
示例2: InitalizeTab
private void InitalizeTab(UIElement content)
{
CloseableTab myTab = new CloseableTab();
int newTab = MasterTabs.Items.Count + 1;
myTab.Title = ((IMainTab)content).TabCaption;
myTab.Picture = new BitmapImage(new Uri(((IMainTab)content).TabIcon));
AttachEventHandlersToTab((IMainTab)content);
Grid tabGrid = new Grid();
tabGrid.SizeChanged += Grid_SizeChanged;
tabGrid.Children.Add(content);
//Fade in the Grid Content
DoubleAnimation fadeInAnimation = new DoubleAnimation();
fadeInAnimation.To = 1;
fadeInAnimation.From = 0;
fadeInAnimation.EasingFunction = new CubicEase();
fadeInAnimation.Duration = TimeSpan.FromSeconds(0.5);
myTab.Content = tabGrid;
MasterTabs.Items.Add(myTab);
MasterTabs.SelectedIndex = MasterTabs.Items.Count-1;
tabGrid.BeginAnimation(Grid.OpacityProperty, fadeInAnimation);
InitializeSidePanels();
//ActionPaneDock.Children.Add(((IMainTab)content).ActionPaneContent);
//TreePaneDock.Children.Add(((IMainTab)content).TreePaneContent);
}
示例3: OnBusyStateChanged
//.........这里部分代码省略.........
throw new InvalidCastException(
string.Format(
"The object being attached to must be of type {0}. Try embedding your visual inside a {0} control, and attaching the behavior to the {0} instead.",
typeof(Grid).Name));
}
if (isBusy)
{
Debug.Assert(LogicalTreeHelper.FindLogicalNode(hostGrid, "BusyIndicator") == null);
bool dimBackground = GetDimBackground(d);
var grid = new Grid
{
Name = "BusyIndicator",
Opacity = 0.0
};
if (dimBackground)
{
grid.Cursor = Cursors.Wait;
grid.ForceCursor = true;
InputManager.Current.PreProcessInput += OnPreProcessInput;
}
grid.SetBinding(FrameworkElement.WidthProperty, new Binding("ActualWidth")
{
Source = hostGrid
});
grid.SetBinding(FrameworkElement.HeightProperty, new Binding("ActualHeight")
{
Source = hostGrid
});
for (int i = 1; i <= 3; ++i)
{
grid.ColumnDefinitions.Add(new ColumnDefinition
{
Width = new GridLength(1, GridUnitType.Star)
});
grid.RowDefinitions.Add(new RowDefinition
{
Height = new GridLength(1, GridUnitType.Star)
});
}
ProgressIndicator = new BusyIndicator() { Width = 150, Height = 120 };
var viewbox = new Viewbox
{
HorizontalAlignment = HorizontalAlignment.Center,
Stretch = Stretch.Uniform,
StretchDirection = StretchDirection.Both,
Child = ProgressIndicator
};
grid.SetValue(Panel.ZIndexProperty, 1000);
grid.SetValue(Grid.RowSpanProperty, Math.Max(1, hostGrid.RowDefinitions.Count));
grid.SetValue(Grid.ColumnSpanProperty, Math.Max(1, hostGrid.ColumnDefinitions.Count));
if (GetAddMargins(d))
{
viewbox.SetValue(Grid.RowProperty, 1);
viewbox.SetValue(Grid.ColumnProperty, 1);
}
else
{
viewbox.SetValue(Grid.RowSpanProperty, 3);
viewbox.SetValue(Grid.ColumnSpanProperty, 3);
}
viewbox.SetValue(Panel.ZIndexProperty, 1);
var dimmer = new Rectangle
{
Name = "Dimmer",
Opacity = GetDimmerOpacity(d),
Fill = GetDimmerBrush(d),
Visibility = (dimBackground ? Visibility.Visible : Visibility.Collapsed)
};
dimmer.SetValue(Grid.RowSpanProperty, 3);
dimmer.SetValue(Grid.ColumnSpanProperty, 3);
dimmer.SetValue(Panel.ZIndexProperty, 0);
grid.Children.Add(dimmer);
grid.Children.Add(viewbox);
grid.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(1.0, GetDimTransitionDuration(d)));
hostGrid.Children.Add(grid);
}
else
{
var grid = (Grid)LogicalTreeHelper.FindLogicalNode(hostGrid, "BusyIndicator");
Debug.Assert(grid != null);
if (grid != null)
{
grid.Name = string.Empty;
var fadeOutAnimation = new DoubleAnimation(0.0, GetDimTransitionDuration(d));
fadeOutAnimation.Completed += (sender, args) => OnFadeOutAnimationCompleted(d, hostGrid, grid);
grid.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
}
}
}
示例4: CreateHeader
public void CreateHeader()
{
// string header = @" __ _ _
/// _\ ___ | | _____ | |__ __ _ _ __
//\ \ / _ \| |/ / _ \| '_ \ / _` | '_ \
//_\ \ (_) | < (_) | |_) | (_| | | | |
//\__/\___/|_|\_\___/|_.__/ \__,_|_| |_|";
string header = "SOKOBAN";
Header = new Grid();
TextBlock text = new TextBlock();
text.Text = header;
text.FontSize = 30;
text.FontFamily = new FontFamily("Comic Sans");
text.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
text.VerticalAlignment = System.Windows.VerticalAlignment.Top;
Header.Children.Add(text);
Header.Margin = new Thickness(0, 10, 0, 0);
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 1.0;
myDoubleAnimation.To = 0.4;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(2));
myDoubleAnimation.AutoReverse = true;
myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
// myStoryboard = new Storyboard();
// myStoryboard.Children.Add(myDoubleAnimation);
Header.BeginAnimation(UIElement.OpacityProperty, myDoubleAnimation);
//Storyboard.SetTargetName(myDoubleAnimation, Header.Opacity);
//////myStoryboard.Begin();
}
示例5: hideShowGrid
private void hideShowGrid(Grid g, DoubleAnimation animation)
{
g.BeginAnimation(Grid.OpacityProperty, animation);
}
示例6: animationFadeGrid
private void animationFadeGrid(Grid grid, double from, double to, int duration)
{
DoubleAnimation animationFade = new DoubleAnimation();
animationFade.From = from;
animationFade.To = to;
animationFade.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
grid.BeginAnimation(Grid.OpacityProperty, animationFade);
}
示例7: FadeGridElement
public static void FadeGridElement(double fromValue, double toValue, Grid control)
{
DoubleAnimation da = new DoubleAnimation(fromValue, toValue, time);
da.DecelerationRatio = acceleration;
control.BeginAnimation(Grid.OpacityProperty, da);
}
示例8: GridAnimation
static public void GridAnimation(DoubleAnimation animation, Grid grid, DependencyProperty dp, int size)
{
animation.To = size;
grid.BeginAnimation(dp, animation, HandoffBehavior.Compose);
}