因此,我试图构建一个应用程序,在其中使用一些ButtonAdv控件。由于我还在编写一些连接到它的触发器,所以我必须访问样式。但是,我无法让basedon属性在这个属性上工作。
<Style x:Key="SyncButtonAdvMainPage" TargetType="{x:Type syncfusion:ButtonAdv}" BasedOn="{StaticResource MetroButtonAdvStyle}">
<Setter Property="Margin" Value="2"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="SizeMode" Value="Normal"/>
<Setter Property="IconHeight" Value="30"/>
</Style>当将它用于无法解析重新源的控件时,会给出一个错误。它适用于常规按钮(而不是同步按钮),因为我在App.xaml中引用的是样式和主题。
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Syncfusion.Shared.WPF;component/SkinManager/MetroStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="MetroButtonBase" TargetType="{x:Type Button}" BasedOn="{StaticResource MetroButtonStyle}">
<Setter Property="Margin" Value="5" />
</Style>
</ResourceDictionary>对此有什么想法吗?谢谢和问候。
发布于 2016-11-22 06:46:14
我查过你的密码了。在此,您已经将MS控件主题资源合并为同步ButtonAdv控件。若要重写同步ButtonAdv控件,可以使用以下路径。
<ResourceDictionary Source="/Syncfusion.Shared.WPF;component/Controls/ButtonControls/Button/Themes/MetroStyle.xaml" />您可以在下面的链接中获得同步控件的资源路径。
https://help.syncfusion.com/wpf/skinmanager/overview#resourcedictionary-path-for-syncfusion-themes
我已经用ButtonAdv属性覆盖了BasedOn控件样式,以使用ButtonAdv样式,并创建了简单的示例。请在下面找到它。
样本:http://www.syncfusion.com/downloads/support/directtrac/general/ze/ButtonAdvSample-422062150180166807
致以敬意,
Keerthana J.
https://stackoverflow.com/questions/40695208
复制相似问题