hi,
i'm using the newest Verison of RadCrontrols for WPF. The ItemSource of my gridView is a MVVM (ObservableCollection<Paketdata>).
I my codebehind i run through all the Items in GridView:
How do i set the Backgroundcolor of the GridViewRow in this case?
Thanks
Best Regards
Rene
i'm using the newest Verison of RadCrontrols for WPF. The ItemSource of my gridView is a MVVM (ObservableCollection<Paketdata>).
I my codebehind i run through all the Items in GridView:
var itemsSource = UebersichtDataGrd.ItemsSource as IEnumerable;
foreach (Paketdata item in itemsSource)
{
if (!string.IsNullOrEmpty(item.Modul))
{
// SET Backgroundcolor of GridView row
}
}
How do i set the Backgroundcolor of the GridViewRow in this case?
Thanks
Best Regards
Rene
5 Answers, 1 is accepted
0
Hi,
Didie
the Telerik team
I would suggest you to use a RowStyleSelector to achieve your goal.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
ITA
Top achievements
Rank 1
answered on 30 Jul 2012, 09:46 AM
Hi,
that's it, but i can't get it run. I created a class "StadiumCapacityStyle":
I made a reference in my xaml-file:
xmlns:my="clr-namespace:ITA_Packetverwaltung.Module.Uebersicht"
VS2010 tells me: "XAML ... Resource is redundant"
GridView:
VS2010: the Resource 'stadiumCapacityStyle' could not be resolved!
This is the Copy of you Link-example!
Thanks
Best Regards
Rene
that's it, but i can't get it run. I created a class "StadiumCapacityStyle":
using System;
using System.Linq;
using System.Windows.Controls;
using System.Windows;
using ITA_Packetverwaltung.Model.Paketdata;
namespace ITA_Packetverwaltung.Module.Uebersicht
{
public class StadiumCapacityStyle : StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
if (item is Paketdata)
{
Paketdata club = item as Paketdata;
if (club.Var10 == "50000")
{
return BigStadiumStyle;
}
else
{
return SmallStadiumStyle;
}
}
return null;
}
public Style BigStadiumStyle { get; set; }
public Style SmallStadiumStyle { get; set; }
}
}
I made a reference in my xaml-file:
xmlns:my="clr-namespace:ITA_Packetverwaltung.Module.Uebersicht"
I tried to add the Grid Resource:
<
my:StadiumCapacityStyle
x:Key
=
"stadiumCapacityStyle"
>
<
my:StadiumCapacityStyle.BigStadiumStyle
>
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
</
Style
>
</
my:StadiumCapacityStyle.BigStadiumStyle
>
<
my:StadiumCapacityStyle.SmallStadiumStyle
>
<
Style
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Background"
Value
=
"White"
/>
</
Style
>
</
my:StadiumCapacityStyle.SmallStadiumStyle
>
</
my:StadiumCapacityStyle
>
VS2010 tells me: "XAML ... Resource is redundant"
GridView:
<
Grid
....
RowStyleSelector
=
"{StaticResource stadiumCapacityStyle}"
>
...
</
Grid
>
VS2010: the Resource 'stadiumCapacityStyle' could not be resolved!
This is the Copy of you Link-example!
Thanks
Best Regards
Rene
0
ITA
Top achievements
Rank 1
answered on 30 Jul 2012, 02:25 PM
Hi,
problem solved. In the documents this is wrong:
Correct ist:
problem solved. In the documents this is wrong:
<Grid
....
RowStyleSelector
=
"{StaticResource stadiumCapacityStyle}"
>
...
</
Grid
>
Correct ist:
<
Grid
....
RowStyleSelector
=
"{DynamicResource stadiumCapacityStyle}"
>
...
</
Grid
>
0
Hello,
Didie
the Telerik team
Thank you for the update.
I have tested the case as you have described but I was able to build the project using 'StaticResource'. The test project I created is attached for a reference.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Nagendra
Top achievements
Rank 1
answered on 27 Sep 2012, 12:55 PM
hi,
how to make the telerik rad grid header as color full.
I have 5 columns each header should be represented by each color how can i achieve it?
how to make the telerik rad grid header as color full.
I have 5 columns each header should be represented by each color how can i achieve it?