Quantcast
Channel: Silverlight 5 forum
Viewing all articles
Browse latest Browse all 1083

Customizing Group Row Header of Silverlight DataGrid

$
0
0

Dear Gurus!

I have 3 groups with field of integer type, wich is codes of region or settlement or town. I want that name of subgroups were names of these objects, not codes. I have wrote 

    public class MyConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,
        System.Globalization.CultureInfo culture)
        {
            CollectionViewGroup cvg = value as CollectionViewGroup;
            string param = parameter as string;
            if (param == "Name")
            {
               return cvg.Name;
             }
            else if (param == "ItemsCount"){

                return "(" + cvg.ItemCount.ToString() + ")";
            }
            else
                return "";
        }

}

This converter returns code of objects. To convert codes to name of object I need to know - what  kind of group is now - region, settlement or town. How I can do that?

PS. First group - region consists of some subgroups - settlements , and each settlement subgrpoup  consists of some subgroups of towns.  In town subgroup  there are objects.

This is xaml in style for DataGridRowGroupHeader where converter is called:

<StackPanel Grid.Column="3" Grid.Row="1"

Orientation="Horizontal" VerticalAlignment="Center" Margin="0,1,0,1"><TextBlock Margin="4,0,0,0" Text="{Binding Converter={StaticResource myConverter}, ConverterParameter=Name}" /><TextBlock x:Name="ItemCountElement1" Margin="4,0,0,0" Text="{Binding Converter={StaticResource myConverter}, ConverterParameter=ItemsCount}" /></StackPanel>





Viewing all articles
Browse latest Browse all 1083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>