<Window x:Class="_790349_RadGridView_WPF_AR_140.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:my="clr-namespace:_790349_RadGridView_WPF_AR_140"
        Title="MainWindow" Height="700" Width="700">
	<Window.Resources>
		<my:MyViewModel x:Key="MyViewModel"/>
        <BooleanToVisibilityConverter x:Key="b2v" />       
	</Window.Resources>
	<Grid DataContext="{StaticResource MyViewModel}">
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>		
		<telerik:RadGridView Grid.Row="0" 
                             Name="clubsGrid" 
                             ItemsSource="{Binding Clubs}"
                             AutoGenerateColumns="False"
                             ShowColumnFooters="True"
                             Margin="5">
			<telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction Caption="Count:"/> 
                    </telerik:GridViewDataColumn.AggregateFunctions>
                    <telerik:GridViewDataColumn.Footer>
                        <StackPanel Orientation="Vertical"
									Margin="0,10">
                            <telerik:AggregateResultsList ItemsSource="{Binding}"
														  VerticalAlignment="Center"
														  Grid.Column="4">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal"
													VerticalAlignment="Center">
                                            <TextBlock VerticalAlignment="Center" 
                                                       Visibility="{Binding IsVisible, Source={StaticResource MyViewModel}, Converter={StaticResource b2v}}"
													   Text="{Binding Caption}" />
                                            <TextBlock VerticalAlignment="Center" 
                                                       Visibility="{Binding IsVisible, Source={StaticResource MyViewModel}, Converter={StaticResource b2v}}"
													   Text="{Binding FormattedValue}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Vertical" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </telerik:AggregateResultsList>
                        </StackPanel>
                    </telerik:GridViewDataColumn.Footer>
                </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                            Header="Est." 
                                            DataFormatString="{}{0:yyyy}"/>
				<telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}" 
                                            Header="Stadium" 
                                            DataFormatString="{}{0:N0}"/>
			</telerik:RadGridView.Columns>
		</telerik:RadGridView>
		<StackPanel Grid.Row="1" Orientation="Horizontal">
            
            <CheckBox Content="IsVisible" IsChecked="{Binding IsVisible, Source={StaticResource MyViewModel}}"/>
          
            
		</StackPanel>
	</Grid>
</Window>
