[英]incomplete mahapps.metro dialogs
I' using mahapps.metro with custom accent. 我使用带有自定义重音的mahapps.metro。 I'm changing accent through code when application starts.
当应用程序启动时,我正在通过代码更改口音。 Since when I have done that dialogs are not showing up properly.
从那时起,这些对话框就无法正确显示。
I couldn't figure out what's going wrong. 我不知道出了什么问题。 My App.xaml is,
我的App.xaml是
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Indigo.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="Assets/ButtonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
and in code, 在代码中
Uri objUri = new Uri("Assets/CustomAccent.xaml", UriKind.Relative);
Accent acc = new Accent("CustomAccent", objUri);
ThemeManager.ChangeTheme(App.Current, acc, Theme.Light);
In my custom accent, I'm just changing the colors, nothing else. 用我自定义的口音,我只是在改变颜色,没有别的。 any idea?
任何想法?
To use a custom accent you must add it to the ThemeManager
before you can use it ( MahApps.Metro
v1.0.0 ). 要使用自定义口音,必须先将其添加到
ThemeManager
( MahApps.Metro
v1.0.0 )。
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// add custom accent and theme resource dictionaries
ThemeManager.AddAccent("CustomAccent1", new Uri("pack://application:,,,/MahAppsMetroThemesSample;component/CustomAccents/CustomAccent1.xaml"));
// get the theme from the current application
var theme = ThemeManager.DetectAppStyle(Application.Current);
// now use the custom accent
ThemeManager.ChangeAppStyle(Application.Current,
ThemeManager.GetAccent("CustomAccent1"),
theme.Item1);
base.OnStartup(e);
}
}
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.