You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WPF样式在Rider设计器不生效但运行时正常的问题求助

WPF样式在Rider设计器中不生效,运行时正常

使用MaterialDesignInXaml框架时,Rider设计器无法加载样式,仅显示控件默认样式,但程序运行后样式能正常生效。此前该框架可正常工作,我已多次重装Rider,严格遵循快速入门指南配置,甚至复制新项目的配置文件,换用MahApps框架也出现同样问题。该问题仅出现在Rider中,Visual Studio 22里样式显示完全正常。

效果对比图:
上方为WPF设计器效果,下方为应用运行时效果

相关代码:

MainWindow.xaml

<Button Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"
        Content="Button 1" FontSize="18"
        Style="{DynamicResource MaterialDesignFlatButton}" />
<Button Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Button 2"
        FontSize="15"
        Style="{DynamicResource MaterialDesignFlatButton}" />
<Button Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Button 3"
        FontSize="15"
        Style="{DynamicResource MaterialDesignFlatButton}" />

App.xaml

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Teal" SecondaryColor="Lime" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

内容的提问来源于stack exchange,提问作者Silviu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.26 07:18:20