我如何找出WPF控件在运行时使用的样式 [英] How do I find out what style a WPF control is using at runtime
本文介绍了我如何找出WPF控件在运行时使用的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下午,
我们有一个WPF用户控件,它承载Infragistics DataGrid.对于该网格中的记录倾斜器,我们具有本地定义的样式,该样式添加了一个复选框(如下所示).这在一个应用程序中可以正常工作,但是在第二个应用程序中,该复选框存在,但看起来很小或不可见.
我相信这是以某种方式继承或使用了其他样式,有人可以告诉我如何在运行时发现正在使用的syle吗?
Afternoon all,
We have a WPF User Control that hosts an Infragistics DataGrid. For the record slector in that grid we have locally defined style that adds a check box (below). This works fine in one application, but in a second application the Checkbox exists but appears to either be very small or not visible.
I believe that this is somehow inheriting or using a different style, can anybody tell me how I can discover what syle is in use at runtime?
<pre lang="xml"><igDataPresenter:XamDataGrid.Resources>
<!-- This Style puts a CheckBox into the record selectors. -->
<Style BasedOn="{x:Null}" TargetType="{x:Type igDataPresenter:RecordSelector}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDataPresenter:RecordSelector}">
<CheckBox HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding Path=DataItem.IsChecked, Mode=TwoWay}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDataPresenter:XamDataGrid.Resources>
谢谢男孩和女孩
Thanks guys and girls
推荐答案
我喜欢使用 WPF史努比 [ ^ ]来查看运行时中的WPF设置和样式.
I like using WPF Snoop[^] to look at WPF settings and styles in runtime.
这篇关于我如何找出WPF控件在运行时使用的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文