Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my XAML Code

HTML
<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>



its similar behind c# code is

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);


i do not know how can i replace
BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}"
with
c# code
Posted
Updated 19-Aug-13 0:44am
v4
Comments
Naz_Firdouse 19-Aug-13 6:09am    
are you using controls from DevExpress??? Do you want to change the default style???
kiranrahir 19-Aug-13 6:34am    
Yes i m using devexpress and want to change style because i want to apply conditinal formating
Sriram Bala 19-Aug-13 6:39am    
Hi Kiranrahir,
Can you update what is the namespace defined for "dxgt:". You can find it at the Header part of the .xaml page. you can find the style defined in App.xaml if there is no separate Project for styles.
kiranrahir 19-Aug-13 6:46am    
I updated question.
Problem is that i can not write resource part in XAML.
want code behind
kiranrahir 19-Aug-13 7:04am    
@Naz_Firdouse
i know c# code for <setter property="Background" value="Green" /> but that is not a solution

1 solution

To apply your own styling, remove the
XML
BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}


and apply your own setters like
HTML
<setter property="Background" value="Green" />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900