本文整理汇总了C#中System.Windows.Controls.Grid.SetZIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.SetZIndex方法的具体用法?C# Grid.SetZIndex怎么用?C# Grid.SetZIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.SetZIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SessionViewModel
//.........这里部分代码省略.........
SessionSVI.CanMove = false;
SessionSVI.CanRotate = false;
SessionSVI.ShowsActivationEffects = false;
displayTrees(new Thickness(20.0 * ratio, 0, 0, 130.0 * ratio), new Thickness(20.0 * ratio, 0, 0, 580.0 * ratio));
PlayBar = new Grid();
PlayBar.Width = 12.0 * ratio;
PlayBar.Height = 490.0 * ratio;
ImageBrush PBImage = new ImageBrush();
PBImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/play_bar.png", UriKind.Relative));
PlayBar.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
PlayBar.VerticalAlignment = System.Windows.VerticalAlignment.Top;
PlayBar.Margin = new Thickness(120.0 * ratio, 99.0 * ratio, 0.0, 0.0);
PlayBar.Background = PBImage;
PlayBar.Opacity = 0.0;
PlayBarCache = new Grid();
PlayBarCache.Width = 1920.0 * ratio;
PlayBarCache.Height = 531.0 * ratio;
PlayBarCache.VerticalAlignment = System.Windows.VerticalAlignment.Top;
PlayBarCache.Margin = new Thickness(0.0, 98.0 * ratio, 0.0, 0.0);
PlayBarCache.Background = ThemeVM.PlayBarCache;
PlayBarCache.Opacity = 0.0;
StaveCache = new Grid();
StaveCache.Width = 1920.0 * ratio;
StaveCache.Height = 491.0 * ratio;
ImageBrush SCImage = new ImageBrush();
SCImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/staves.png", UriKind.Relative));
StaveCache.VerticalAlignment = System.Windows.VerticalAlignment.Top;
StaveCache.Margin = new Thickness(0.0, 98.0 * ratio, 0.0, 0.0);
StaveCache.Background = SCImage;
StaveCache.Opacity = 0.0;
Grid.Children.Add(PlayBar);
Grid.Children.Add(PlayBarCache);
Grid.Children.Add(StaveCache);
Grid.Children.Add(Bubbles);
Grid.Children.Add(Notes);
Grid.Children.Add(NbgVM.Grid);
Grid.Children.Add(MbgVM.Grid);
Grid.Children.Add(Play_Button);
Grid.Children.Add(Tempo_Button);
Grid.Children.Add(UpdateSound.Grid);
Grid.Children.Add(previewGrid);
Grid.Children.Add(topStaveHighlight);
Grid.Children.Add(bottomStaveHighlight);
Grid.SetZIndex(UpdateSound.Grid, 7);
Grid.SetZIndex(TreeUp.Grid, 6);
Grid.SetZIndex(TreeDown.Grid, 6);
Grid.SetZIndex(Bubbles, 5);
Grid.SetZIndex(Notes, 4);
Grid.SetZIndex(NbgVM.Grid, 3);
Grid.SetZIndex(MbgVM.Grid, 3);
Grid.SetZIndex(Play_Button, 3);
Grid.SetZIndex(Theme_Button, 3);
Grid.SetZIndex(Tempo_Button, 3);
Grid.SetZIndex(previewGrid, 2);
Grid.SetZIndex(StaveCache, 2);
Grid.SetZIndex(topStaveHighlight, 2);
Grid.SetZIndex(bottomStaveHighlight, 2);
Grid.SetZIndex(PlayBarCache, 1);
Grid.SetZIndex(PlayBar, 0);
SessionSVI.Content = Grid;
ThemeChooser = new ThemeChooser(this);
Theme_Button.PreviewTouchDown += new EventHandler<TouchEventArgs>(ThemeChooser.Theme_Button_TouchDown);
int i = 1;
while (IDs.Contains(i)) i++;
SessionID = i;
IDs.Add(i);
SetDimensions(width, height);
SessionSVI.Center = new Point(width / 2.0, height / 2.0);
if (animated) Animation = new SessionAnimation(this);
DeleteButton = new SurfaceButton();
DeleteButton.Visibility = Visibility.Hidden;
ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/delete-icon.png", UriKind.Relative));
DeleteButton.Background = ib;
DeleteButton.Width = 25.0;
DeleteButton.Height = 25.0;
DeleteButton.HorizontalAlignment = HorizontalAlignment.Left;
DeleteButton.VerticalAlignment = VerticalAlignment.Top;
Grid.Children.Add(DeleteButton);
Grid.SetZIndex(DeleteButton, 1000);
DeleteButton.PreviewTouchDown += new EventHandler<TouchEventArgs>(DeleteButton_PreviewTouchDown);
SessionSVI.SizeChanged += new SizeChangedEventHandler(SessionSVI_SizeChanged);
SessionSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(SessionSVI_TouchLeave);
}
示例2: TreeViewModel
/// <summary>
/// Constructor of a TreeViewModel
/// </summary>
/// <param name="up"></param>
/// <param name="t"></param>
/// <param name="s"></param>
public TreeViewModel(bool up, Thickness t, SessionViewModel s)
{
this.Up = !up;
SessionVM = s;
ratio = s.SessionSVI.Width / 1920.0;
Grid = new Grid();
Grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
Grid.Margin = t;
Grid.Height = 210.0 * ratio;
Grid.Width = 210.0 * ratio;
if (Up)
{
Instrument1 = new Instrument(SessionVM.Session.Theme.InstrumentsTop[0].Name);
Instrument2 = new Instrument(SessionVM.Session.Theme.InstrumentsTop[1].Name);
}
else
{
Instrument1 = new Instrument(SessionVM.Session.Theme.InstrumentsBottom[0].Name);
Instrument2 = new Instrument(SessionVM.Session.Theme.InstrumentsBottom[1].Name);
}
Images = new List<Grid>();
Images.Add(createGridForImage(Instrument1.Name.ToString(), 100.0 * ratio, 100.0 * ratio, HorizontalAlignment.Left, VerticalAlignment.Center));
Images.Add(createGridForImage(Instrument1.Name.ToString(), 100.0 * ratio, 100.0 * ratio, HorizontalAlignment.Right, VerticalAlignment.Top));
Images.Add(createGridForImage(Instrument2.Name.ToString(), 100.0 * ratio, 100.0 * ratio, HorizontalAlignment.Right, VerticalAlignment.Bottom));
Grid root = createGridForLinks("root", 50.0 * ratio, 50.0 * ratio, new Thickness(0, 0, 100.0 * ratio, 0));
Images.Add(root);
Images.Add(createGridForLinks("lower_branch", 80.0 * ratio, 120.0 * ratio, new Thickness(50.0 * ratio, 60.0 * ratio, 50.0 * ratio, 0.0)));
Images.Add(createGridForLinks("upper_branch", 80.0 * ratio, 120.0 * ratio, new Thickness(50.0 * ratio, 0.0, 50.0 * ratio, 60.0 * ratio)));
Images[0].Visibility = Visibility.Visible;
foreach (Grid g in Images) Grid.Children.Add(g);
Grid.SetZIndex(root, 300);
Images[0].TouchDown += new EventHandler<TouchEventArgs>(touchDown0);
Images[1].TouchDown += new EventHandler<TouchEventArgs>(touchDown1);
Images[2].TouchDown += new EventHandler<TouchEventArgs>(touchDown2);
Images[3].TouchDown += new EventHandler<TouchEventArgs>(touchDown1);
}