normalham2
Top achievements
Rank 1
normalham2
asked on 20 Jul 2010, 10:12 PM
How do I change the row background color for the parent row, and a different row background color for the child rows?
Thanks,
Todd
7 Answers, 1 is accepted
0
Hello normalham2,
And then:
Sincerely yours,
Maya
the Telerik team
You may define two different styles with TargetType - GridViewRow and apply each of them to the desired grid using the RowStyle Property. For example:
<
UserControl.Resources
>
<
Style
x:Key
=
"childRowStyle"
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"AliceBlue"
/>
</
Style
>
<
Style
x:Key
=
"parentRowStyle"
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Bisque"
/>
</
Style
>
</
UserControl.Resources
>
And then:
<
telerik:RadGridView
Name
=
"playersGrid"
RowStyle
=
"{StaticResource childRowStyle}"
ItemsSource
=
"{Binding Players}"
/>
<
telerik:RadGridView
Name
=
"clubsGrid"
RowStyle
=
"{StaticResource parentRowStyle}"
ItemsSource
=
"{Binding Clubs}"
/>
Sincerely yours,
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Juan
Top achievements
Rank 1
answered on 05 Aug 2010, 12:45 PM
Hi Maya!
How can I change row backround using binding ? I have several types of items and they should have different background color.
How can I change row backround using binding ? I have several types of items and they should have different background color.
0
Hi Juan,
Maya
the Telerik team
In this case, depending on your exact requirements, you may consider using Conditional Styling and developing different StyleSelectors on different rows. You may find an example on how to do that in our demos.
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Juan
Top achievements
Rank 1
answered on 06 Aug 2010, 06:26 AM
Thank you Maya,
But I can't find Telerik.Windows.Examples namespace and source code for UnitPriceConveter used in that demo.
But I can't find Telerik.Windows.Examples namespace and source code for UnitPriceConveter used in that demo.
0
Hello,
Sincerely yours,
Vlad
the Telerik team
If you download our demos you can find these classes in StyleSelectors folder. Here is the code for UnitPriceConveter:
public
class
UnitPriceConveter : IValueConverter
{
#region IValueConverter Members
public
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
Products product = value
as
Products;
if
(product !=
null
)
{
return
product.UnitPrice > 30 ?
true
:
false
;
}
return
null
;
}
public
object
ConvertBack(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
throw
new
NotImplementedException();
}
#endregion
}
Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Cristina
Top achievements
Rank 1
answered on 25 Oct 2010, 03:09 PM
Hi, this example can be used for RadTreeListView? If feasible, what would the declaration in the <telerik: RadTreeListView?. Thanks
0
Hello Cristina,
Vlad
the Telerik team
You can check our online demos for more info.
Greetings,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items