Hi,,,here in my WPF application am using listview with 5 columns and one of the column has flag value and my requirement is, if the flag value is True then i have to set the forground of the row to RED color....Thank you
A:
Use a value converter
Resources
- http://www.kirupa.com/blend_wpf/value_converters_pg1.htm
- http://blogs.msdn.com/b/vsdata/archive/2010/05/11/customizing-your-wpf-silverlight-ui-using-value-converter-and-or-partial-class-properties.aspx
Or concider MVVM-like patern
rudigrobler
2010-09-16 10:12:45
I cant get your code from msdn,beacuse am new to wpf,so could you please give me a clear solution for this nad here is my code – Prabhakaran 1 min ago edit I cant get your code from msdn,beacuse am new to wpf,so could you please give me a clear solution for this nad here is my code <GridViewColumn DisplayMemberBinding="{Binding Path=IsCompleted}" Width="50" > <GridViewColumnHeader HorizontalAlignment="Stretch">IsCompleted</GridViewColumnHeader> </GridViewColumn> if this value is TRUE i need to get the entire listitem foregrund as RED color
Prabhakaran
2010-09-16 10:46:21
A:
Create a style for the ListBoxItem
with a DataTrigger
that changes the color.
In fact, the MSDN entry on DataTrigger contains an example which is quite close to what you want: It changes the Foreground color to Red based on a data value.
Heinzi
2010-09-16 10:19:11
I cant get your code from msdn,beacuse am new to wpf,so could you please give me a clear solution for this nad here is my code
Prabhakaran
2010-09-16 10:44:37
<GridViewColumn DisplayMemberBinding="{Binding Path=IsCompleted}" Width="50" > <GridViewColumnHeader HorizontalAlignment="Stretch">IsCompleted</GridViewColumnHeader> </GridViewColumn> if this value is TRUE i need to get the entire listitem foregrund as RED color
Prabhakaran
2010-09-16 10:45:43
Please show the XAML code of your complete ListView. You can use the "edit" button below your question to add it to your question.
Heinzi
2010-09-16 10:58:11