本文整理汇总了C#中MahApps.Metro.Controls.MetroWindow.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# MetroWindow.SetValue方法的具体用法?C# MetroWindow.SetValue怎么用?C# MetroWindow.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MahApps.Metro.Controls.MetroWindow
的用法示例。
在下文中一共展示了MetroWindow.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureWindow
protected override Window EnsureWindow(object model, object view, bool isDialog) {
var window = view as Window;
if (window == null) {
var metroWindow = new MetroWindow {
Content = view,
SizeToContent = SizeToContent.WidthAndHeight,
TitlebarHeight = 0
};
window = metroWindow;
//Interaction.GetBehaviors(metroWindow).Add(new GlowWindowBehavior());
metroWindow.SetValue(MoveableWindowBehavior.IsEnabledProperty, true);
metroWindow.SetValue(View.IsGeneratedProperty, true);
var owner = InferOwnerOf(window);
if (owner != null) {
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.Owner = owner;
} else
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
} else {
var owner = InferOwnerOf(window);
if ((owner != null) && isDialog)
window.Owner = owner;
}
SetupRxWindow(model, view, window);
return window;
}
示例2: EnsureWindow
protected override Window EnsureWindow(object model, object view, bool isDialog)
{
var window = view as MetroWindow;
if (window == null)
{
window = new MetroWindow { Content = view, };
window.SetValue(View.IsGeneratedProperty, true);
window.Resources.MergedDictionaries.Add(this.themeManager.GetThemeResources());
var owner = this.InferOwnerOf(window);
if (owner != null)
{
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowInTaskbar = false;
window.Owner = owner;
}
else
{
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
}
else
{
var owner2 = this.InferOwnerOf(window);
if (owner2 != null && isDialog)
{
window.ShowInTaskbar = false;
window.Owner = owner2;
}
}
return window;
}
示例3: EnsureWindow
protected override Window EnsureWindow(object model, object view, bool isDialog)
{
var metroWindow = view as MetroWindow;
if (metroWindow == null)
{
var userControl = view as UserControl;
double minHeight = 150D;
double minWidth = 500D;
double? height = null;
double? width = null;
if (userControl != null)
{
minHeight = userControl.MinHeight;
minWidth = userControl.MinWidth;
height = userControl.Height;
width = userControl.Width;
}
metroWindow = new MetroWindow
{
Content = view,
SizeToContent = SizeToContent.Manual,
MinHeight = minHeight,
MinWidth = minWidth,
SaveWindowPosition = true
};
if (height.HasValue && width.HasValue)
{
metroWindow.Height = height.Value;
metroWindow.Width = width.Value;
}
foreach (var resourceDict in _resources)
{
metroWindow.Resources.MergedDictionaries.Add(resourceDict);
}
metroWindow.SetValue(View.IsGeneratedProperty, true);
var owner = this.InferOwnerOf(metroWindow);
if (owner != null)
{
metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
metroWindow.Owner = owner;
}
else
{
metroWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
}
else
{
var owner = this.InferOwnerOf(metroWindow);
if (owner != null && isDialog)
metroWindow.Owner = owner;
}
return metroWindow;
}
示例4: CreateMetroWindow
private MetroWindow CreateMetroWindow(object view)
{
var metroWindow = new MetroWindow
{
Content = view,
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
metroWindow.SetValue(View.IsGeneratedProperty, true);
AddMetroResources(metroWindow);
var owner = InferOwnerOf(metroWindow);
if (owner != null)
{
metroWindow.Owner = owner;
metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
return metroWindow;
}
示例5: EnsureWindow
protected override Window EnsureWindow(object model, object view, bool isDialog)
{
if (!isDialog)
return base.EnsureWindow(model, view, isDialog);
var window = view as MetroWindow;
if (window == null)
{
var userControl = view as UserControl;
var appShell = IoC.Get<MainViewModel>() as IViewAware;
//var scrollViewer = new ScrollViewer { Content = view };
window = new MetroWindow
{
//Content = scrollViewer,
Content = view,
SizeToContent = SizeToContent.WidthAndHeight,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
if (userControl != null)
{
window.MinHeight = userControl.MinHeight;
window.MinWidth = userControl.MinWidth;
}
//scrollViewer.SetValue(View.IsGeneratedProperty, true);
window.SetValue(View.IsGeneratedProperty, true);
window.Owner = appShell.GetView() as Window;
window.ShowCloseButton = false;
window.ShowMaxRestoreButton = false;
window.ShowMinButton = false;
window.GlowBrush = new SolidColorBrush(Colors.Gray);
}
return window;
}