- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我这样做:
<Controls:MetroWindow x:Class="BS.Expert.Client.App.Views.ShellView"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShowTitleBar="True"
Title="My Title">
public class ShellViewModel : Conductor<IScreen>.Collection.OneActive, IShell
{
public ShellViewModel()
{
#region mahApps Theme Loading
var theme = ThemeManager.DetectAppStyle(Application.Current);
var appTheme = ThemeManager.GetAppTheme(App.Configuration.Theme);
ThemeManager.ChangeAppStyle(Application.Current, theme.Item2, appTheme);
#endregion
//TODO: Changing Title here is not possible ((MetroWindow)this).Title = "No way";
// Tudo bem na seguinte liña
LocalizeDictionary.Instance.Culture = new System.Globalization.CultureInfo("pt-BR");
ShowPageOne();
}
public void ShowPageOne()
{
ActivateItem(new PageOneViewModel());
}
}
最佳答案
当使用 MVVM 模式时,你永远不应该尝试像这样直接在 View 模型中设置 View 上的任何内容。而是使用数据绑定(bind)来完成此操作。
所以你会在你的 ShellViewModel 上有一个属性,比如:
public string MyTitle
{
get { return _myTitle; }
set
{
_myTitle = value;
//Insert your property change code here (not sure of the caliburn micro version)
}
}
<Controls:MetroWindow
Title="{Binding MyTitle}"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
...
>
关于caliburn.micro - 无法使用 MahApps MetroWindow 在 Caliburn.Micro Conductor View 中更改标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31541063/
如何通过 Caliburn.Micro IWindowManager Show 方法在动态创建的 MetroWindow 中绑定(bind)/创建 MetroWindow.RightWindowCom
我有一个简单的测试应用程序,它显示了一个带有附加行为的简单 Mahapps MetroWindow。问题是在附加行为时绘制了 Mahapps MetroWindow 的外边框。
我遇到一个错误名称 metroWindow 在命名空间中不存在:MahApps.Metro.Controls;assembly=MahApps.Metro"我不知道问题出在哪里我也检查了被 NuGet
我正在使用 Mahapps.MetroWindow ( http://mahapps.com/ ) 来设计我的应用程序外观,现在我正在寻找自定义 X/关闭按钮外观的正确方法。默认情况下,MetroWi
我无法在 MetroWindow 标题中更改字体粗细。我怎样才能做到这一点? 我可以在 MetroWindow 属性中设置 FontWeihgt,但它会影响我的 XAML 代码中的所有控件......
我正在使用带有 MVVM 的 MahApps.metro WPF 库。我有一个 ViewModel,我需要从中显示一个对话框。 MetroWindow 有 ShowMessageAsync。但是从 V
我对 MVVM 概念和 Caliburn 比较陌生,但我遇到了一个问题。 我正在开发的应用程序使用 Mahapps.Metro 在 WPF 上进行“类似地铁”的设计,而我正在使用 Caliburn M
我这样做: 问题是,这同时是主窗口上定义的主导体,我用它控制通过其他窗口的导航,所以我不能从 MetroWindow 继承,至少尝试更改 ViewModel 中的标题: public class S
我是一名优秀的程序员,十分优秀!