小编Kir*_*hir的帖子

什么是代码"{StaticResource {dxgt:GridRowThemeKey ResourceKey = RowStyle}}"

这是我的XAML代码

<Window x:Class="Q316995.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
        xmlns:local="clr-namespace:Q316995"
        Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <ResourceDictionary>
        <Style x:Key="LastRowHighlighted"
                BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}"
                TargetType="{x:Type dxg:GridRowContent}">
        </Style>
    </ResourceDictionary>
</Window.Resources>
</Window>
Run Code Online (Sandbox Code Playgroud)

它与c#代码背后的相似之处在于

Binding _Binding = new Binding();
_Binding.Converter = new LastRowHighlighter();

Setter _Setter = new Setter();
_Setter.Property = GridRowContent.FontWeightProperty;
_Setter.Value = _Binding;

Style _Style = new System.Windows.Style();
//_Style.BasedOn = new Style(typeof(GridRowContent));
_Style.TargetType = typeof(GridRowContent);
_Style.Setters.Add(_Setter);

grid.Resources.Add("LastRowHighlighted", _Style);
Run Code Online (Sandbox Code Playgroud)

我不知道如何更换

BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}"
Run Code Online (Sandbox Code Playgroud)

用c#代码.Grid是Devexpress的GridControl

wpf styles settext staticresource

5
推荐指数
1
解决办法
5116
查看次数

标签 统计

settext ×1

staticresource ×1

styles ×1

wpf ×1