本文整理汇总了C#中MahApps.Metro.Controls.MetroWindow.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# MetroWindow.SetResourceReference方法的具体用法?C# MetroWindow.SetResourceReference怎么用?C# MetroWindow.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MahApps.Metro.Controls.MetroWindow
的用法示例。
在下文中一共展示了MetroWindow.SetResourceReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWindow
private System.Windows.Window CreateWindow(FrameworkElement view, System.Windows.Window owner,
IDialogRegister dialog = null)
{
var window = new MetroWindow()
{
Content = view,
ResizeMode =
dialog == null
? ResizeMode.NoResize
: dialog.AllowResize ? ResizeMode.CanResize : ResizeMode.NoResize,
Topmost = !Debugger.IsAttached,
ShowInTaskbar = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
window.SetResourceReference(FrameworkElement.StyleProperty, "Window");
if (owner != null && owner.IsVisible)
window.Owner = owner;
if (dialog != null && dialog.Size.HasValue)
{
window.Width = dialog.Size.Value.Width;
window.Height = dialog.Size.Value.Height;
}
else if (double.IsNaN(view.Width) && double.IsNaN(view.Height))
{
window.SizeToContent = SizeToContent.WidthAndHeight;
var behaviors = Interaction.GetBehaviors(window);
if (behaviors != null)
behaviors.Add(new WindowChromeSizeToContentBehavior());
}
else if (double.IsNaN(view.Width))
{
window.SizeToContent = SizeToContent.Width;
window.Height = view.Height + SystemParameters.WindowCaptionHeight +
SystemParameters.ResizeFrameHorizontalBorderHeight;
}
else if (double.IsNaN(view.Height))
{
window.SizeToContent = SizeToContent.Height;
window.Width = view.Width +
SystemParameters.ResizeFrameHorizontalBorderHeight;
}
else
{
window.SizeToContent = SizeToContent.Manual;
window.Width = view.Width +
SystemParameters.ResizeFrameHorizontalBorderHeight;
window.Height = view.Height + SystemParameters.WindowCaptionHeight +
SystemParameters.ResizeFrameHorizontalBorderHeight;
}
return window;
}