0

当我尝试在特定窗口中使用主题文件时,我无法将按钮添加到界面。vs 2012 Designer 火灾异常。我认为主题文件之间存在混淆。因为我在两个地方使用它们:

我的窗口包含以下资源部分:

Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="themes\ShinyDarkGreen.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

和我的 app.xaml

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source ="themes\BureauBlue.xaml"/>
            <ResourceDictionary Source ="themes\ResourceDictionary.xaml"/>
            <ResourceDictionary Source="themes\GlassButton.xaml"/>
            <ResourceDictionary Source="themes\Mesthemes.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

我在主窗口中使用了“BureauBlue.xaml”,我想在另一个窗口中使用 ShinyDarkGreen.xaml。有什么办法可以做到这一点

我的操作系统设置是法语:

Exception : InvalidCastException : Impossible d'effectuer un cast d'un objet de type 'System.Windows.Media.Color' en type 'System.Windows.Media.Brush'.

à MS.Internal.Text.TextProperties.InitCommon(DependencyObject target)
à MS.Internal.Text.TextProperties..ctor(FrameworkElement target, Boolean isTypographyDefaultValue)
à System.Windows.Controls.TextBlock.GetLineProperties()
à System.Windows.Controls.TextBlock.EnsureTextBlockCache()
à System.Windows.Controls.TextBlock.MeasureOverride(Size constraint)
à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
à System.Windows.UIElement.Measure(Size availableSize)
à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
à System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
à System.Windows.UIElement.Measure(Size availableSize)
à System.Windows.ContextLayoutManager.UpdateLayout()
à System.Windows.UIElement.UpdateLayout()

InnerException : aucun
4

0 回答 0