本文整理匯總了C#中Windows.UI.Xaml.Controls.Canvas.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Canvas.SetValue方法的具體用法?C# Canvas.SetValue怎麽用?C# Canvas.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.Controls.Canvas
的用法示例。
在下文中一共展示了Canvas.SetValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Show
public void Show()
{
_popup = new Popup
{
IsLightDismissEnabled = false
};
_popup.SetValue(Canvas.TopProperty, 0);
_popup.SetValue(Canvas.LeftProperty, 0);
_popup.Loaded += OnPopupLoaded;
_popup.Closed += OnPopupClosed;
Window.Current.Activated += OnWindowActivated;
_popup.ChildTransitions = new TransitionCollection
{
new PopupThemeTransition()
};
Height = PopupHeight;
Width = Window.Current.Bounds.Width;
Canvas layoutRoot = new Canvas();
layoutRoot.SetValue(WidthProperty, Window.Current.Bounds.Width);
layoutRoot.SetValue(HeightProperty, Window.Current.Bounds.Height);
layoutRoot.Background = _backgroundBrush;
layoutRoot.Children.Add(this);
SetValue(Canvas.TopProperty, (Window.Current.Bounds.Height - PopupHeight) / 2);
_popup.Child = layoutRoot;
_popup.IsOpen = true;
_viewModel = DataContext as ViewModelBase;
if (_viewModel != null)
{
_viewModel.OnNavigatedTo(new NavigationArgs(NavigationArgs.NavigationMode.New), ParametersKey);
}
}