Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf “代码”的背后是什么;{StaticResource{dxgt:GridRowThemeKey ResourceKey=RowStyle}}";_Wpf_Styles_Settext_Staticresource - Fatal编程技术网

Wpf “代码”的背后是什么;{StaticResource{dxgt:GridRowThemeKey ResourceKey=RowStyle}}";

Wpf “代码”的背后是什么;{StaticResource{dxgt:GridRowThemeKey ResourceKey=RowStyle}}";,wpf,styles,settext,staticresource,Wpf,Styles,Settext,Staticresource,这是我的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/xa

这是我的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>
我不知道我该怎么替换

BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}"

用c代码。Grid是Devexpress的GridControl

样式
类有一个构造函数,它接受一个
样式
对象,以新的
样式
为基础。您还可以根据找到的设置
Style.BasedOn
属性

您可以使用以下命令从应用程序的
资源
部分访问默认
样式集

Application.Current.TryFindResource(typeof(GridRowContent));
Style style = new Style(typeof(GridRowContent), Application.Current.TryFindResource(
typeof(GridRowContent)));
因此,请尝试以下方法:

Application.Current.TryFindResource(typeof(GridRowContent));
Style style = new Style(typeof(GridRowContent), Application.Current.TryFindResource(
typeof(GridRowContent)));
它正在引发错误{“'GridRowContent'TargetType与元素'TableView'的类型不匹配”。}。