Grid splitter control should resize data grid height.

2 Answers 637 Views
DataGrid GridSplitter TabControl
Boris
Top achievements
Rank 1
Boris asked on 22 Sep 2022, 10:33 PM | edited on 22 Sep 2022, 10:43 PM

In the Grid there are three rows. On the top row is the DataGrid control and on in the middle row there is GridSplitter control then on the bottom is the TabControl.

The requirement is for the GridControl to resize when the GridSplitter resizes the Grid.  There should be a MinHeight property set to display a minimum of 6 rows and GridControl should resize.

Current behavior is that GridControl takes all the space and does not resize when the Grid Splitter is moved up or down.


<Page
    x:Class="CSA2.Views.SearchUserPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CSA2.Views"
    xmlns:vm="using:CSA2.ViewModels"
    xmlns:controls="using:CSA2.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="using:Microsoft.Xaml.Interactivity"
    xmlns:telerik="using:Telerik.UI.Xaml.Controls"
    xmlns:telerikGrid="using:Telerik.UI.Xaml.Controls.Grid"
    xmlns:telerikPrimitives="using:Telerik.UI.Xaml.Controls.Primitives"
    xmlns:gridPrimitives="using:Telerik.UI.Xaml.Controls.Grid.Primitives"
    xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d">
    <Page.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="ColumnHeaderCompleteTemplate">
                <FontIcon
                    Margin="0,3,0,0"
                    FontSize="16"
                    Glyph="&#xE73E;" />
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>
    <Grid  x:Name="ContentArea" Margin="{StaticResource SmallTopBottomMargin}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Margin="0 5 0 5">
            <TextBlock x:Uid="SearchUser" Style="{ThemeResource SubtitleTextBlockStyle}"/>
            <Border BorderThickness=".5" BorderBrush="LightGray" CornerRadius="2">
                <Grid Margin="0 5 0 5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <StackPanel>
                        <Grid HorizontalAlignment="Left">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock x:Uid="UserNameText"
                                       Grid.Row="0"
                                       Grid.Column="0"
                                       VerticalAlignment="Center"
                                       Margin="5 0 5 0"/>
                            <TextBox x:Uid="UserNameNullText"
                                     Grid.Row="0"
                                     Grid.Column="1"
                                     Margin="0 0 5 0"
                                     Width="200"
                                     Text="{x:Bind ViewModel.UserName, Mode=TwoWay}"/>
                            <TextBlock Grid.Row="0" x:Uid="UserEmailText"
                                       Grid.Column="2"
                                       VerticalAlignment="Center"
                                       Margin="0 0 5 0"/>
                            <TextBox x:Uid="UserEmailNullText"
                                     Grid.Row="0"
                                     Grid.Column="3"
                                     Width="200"
                                     Text="{x:Bind ViewModel.UserEmail, Mode= TwoWay}"/>
                            <TextBlock x:Uid="UserRoleText"
                                       Grid.Row="0"
                                       Grid.Column="4"
                                       VerticalAlignment="Center"
                                       Margin="5 0 5 0"/>
                            <Button Grid.Row="0"
                                    Grid.Column="5"
                                    Margin="0 0 0 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE70D;"/>
                                    </StackPanel>
                                </StackPanel>
                                <Button.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserRoles" ItemsSource="{x:Bind ViewModel.UserRoles, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserRoles.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </Button.Flyout>
                            </Button>
                            <TextBlock x:Uid="UserDepartmentText"
                                       Grid.Row="0"
                                       Grid.Column="6"
                                       VerticalAlignment="Center"
                                       Margin="5 0 5 0"/>
                            <Button Grid.Row="0"
                                    Grid.Column="7"
                                    Margin="0 0 0 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE70D;"/>
                                    </StackPanel>
                                </StackPanel>
                                <Button.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserDepartments" ItemsSource="{x:Bind ViewModel.UserDepartments, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserDepartments.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </Button.Flyout>
                            </Button>
                            <TextBlock x:Uid="UserFunctionsText"
                                       Grid.Row="0"
                                       Grid.Column="8"
                                       VerticalAlignment="Center"
                                       Margin="5 0 5 0"/>
                            <Button Grid.Row="0"
                                    Grid.Column="9"
                                    Margin="0 0 0 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE70D;"/>
                                    </StackPanel>
                                </StackPanel>
                                <Button.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserFunctions" ItemsSource="{x:Bind ViewModel.UserFunctions, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserFunctions.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </Button.Flyout>
                            </Button>
                            <Button Grid.Row="0"
                                    Grid.Column="10"
                                    Margin="5 0 0 0"
                                    Command="{x:Bind ViewModel.SearchCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="SearchButtonText"
                                               Margin="0 0 10 0" />
                                    <SymbolIcon Symbol="Zoom"/>
                                </StackPanel>
                            </Button>
                            <Button Grid.Row="1"
                                    Grid.Column="9"
                                    Command="{x:Bind ViewModel.AddUserCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="CreateNewButtonText" Margin="0 0 20 0"/>
                                    <SymbolIcon Symbol="AddFriend"/>
                                </StackPanel>
                            </Button>
                            <Button Grid.Row="1"
                                    Grid.Column="10"
                                    Margin="5 0 0 0"
                                    Command="{x:Bind ViewModel.ClearCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="ClearButtonText" Margin="0 0 20 0"/>
                                    <SymbolIcon Symbol="Refresh"/>
                                </StackPanel>
                            </Button>
                        </Grid>
                    </StackPanel>
                </Grid>
            </Border>
        </StackPanel>
        <Grid Grid.Row="1" Margin="0 5 0 5">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <telerikGrid:RadDataGrid x:Name="UserGrid"
                                     MinHeight="150"
                                     ItemsSource="{x:Bind ViewModel.Source}"
                                     AutoGenerateColumns="False"
                                     RowHeight="25"
                                     SelectionMode="Multiple"
                                     SelectionUnit="Row"
                                     UserGroupMode="Disabled">
                <i:Interaction.Behaviors>
                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                        <ic:InvokeCommandAction
                            Command="{x:Bind ViewModel.SelectedUsersCommand}"
                            CommandParameter="{x:Bind UserGrid.SelectedItems,Mode=OneWay}"/>
                    </ic:EventTriggerBehavior>
                </i:Interaction.Behaviors>
                <telerikGrid:RadDataGrid.Columns>
                    <telerikGrid:DataGridTemplateColumn SizeMode="Fixed" Width="20">
                        <telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                            <DataTemplate>
                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <CheckBox/>
                                </StackPanel>
                            </DataTemplate>
                        </telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                    </telerikGrid:DataGridTemplateColumn>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="UserName" Header="Name"/>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="UserEmail" Header="Email"/>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="DepartmentName" Header="Department"/>
                    <telerikGrid:DataGridBooleanColumn SizeMode="Auto" PropertyName="UserActiveIndicator" Header="User Status" />
                    <telerikGrid:DataGridDateColumn SizeMode="Auto" PropertyName="RecordCreated" Header="Date Created" CellContentFormat="{}{0:d}"/>
                    <telerikGrid:DataGridDateColumn SizeMode="Auto" PropertyName="RecordModified" Header="Date Modified" CellContentFormat="{}{0:d}"/>
                </telerikGrid:RadDataGrid.Columns>
            </telerikGrid:RadDataGrid>
            <telerikPrimitives:RadGridSplitter Grid.Row="1"
                                               ResizeBehavior="BasedOnAlignment"
                                               ResizeDirection="Rows"
                                               HorizontalAlignment="Stretch">
                <telerikPrimitives:RadGridSplitter.Element>
                    <FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE76F;" FontSize="10"/>
                </telerikPrimitives:RadGridSplitter.Element>
            </telerikPrimitives:RadGridSplitter>
            <Grid Grid.Row="2" Margin="0 2 0 0">
                <telerik:RadTabControl>
                    <telerik:RadTabControl.Items>
                        <telerik:RadTabItem Header="User Details">
                            <telerik:RadTabItem.Content>
                                <controls:AddEditControl x:Name="AddEditControl" DataContext="{x:Bind ViewModel.UserDetailsViewModel}" />
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                        <telerik:RadTabItem Header="Tab 2" Content="The content of tab item 2"/>
                        <telerik:RadTabItem Header="Tab 3" Content="The content of tab item 3"/>
                        <telerik:RadTabItem Header="Tab 4" Content="The content of tab item 4"/>
                    </telerik:RadTabControl.Items>
                </telerik:RadTabControl>
            </Grid>
        </Grid>
    </Grid>
</Page>

 

2 Answers, 1 is accepted

Sort by
0
Vicky
Telerik team
answered on 23 Sep 2022, 08:23 AM

Hi Boris,

Thanks for the provided resources - they were of great help.

If I correctly understand the requirement, you want to always see at least 6 rows and in the same time be able to resize the DataGrid to preview more than these 6 rows:

If this is right, the MinHeight that you set to the RadDataGrid should be set to the respective RowDefinition instead:

<Grid Grid.Row="1" Margin="0 5 0 5">
            <Grid.RowDefinitions>
                <RowDefinition MinHeight="192" Height="*"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <telerikGrid:RadDataGrid x:Name="UserGrid"
                                     ItemsSource="{x:Bind ViewModel.Source}"
                                     AutoGenerateColumns="False"
                                     RowHeight="25"
                                     SelectionMode="Multiple"
                                     SelectionUnit="Row"
                                     UserGroupMode="Disabled">

...

</Grid>

Please, try out the above suggested approach and let me know if this is what you are looking for.

Best Regards,
Vicky
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Boris
Top achievements
Rank 1
commented on 23 Sep 2022, 05:00 PM

I tried the suggested approach.

However the DataGrid is not showing only six rows.

The user should be able to stretch the DataGrid when the GridSplitter is moving up or down. That was the user's requirement to have more space on the bottom of the GridSplitter. Attached a screenshot.


<Page
    x:Class="CSA2.Views.SearchUserPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CSA2.Views"
    xmlns:vm="using:CSA2.ViewModels"
    xmlns:controls="using:CSA2.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="using:Microsoft.Xaml.Interactivity"
    xmlns:telerik="using:Telerik.UI.Xaml.Controls"
    xmlns:telerikGrid="using:Telerik.UI.Xaml.Controls.Grid"
    xmlns:telerikPrimitives="using:Telerik.UI.Xaml.Controls.Primitives"
    xmlns:gridPrimitives="using:Telerik.UI.Xaml.Controls.Grid.Primitives"
    xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d">
    <Page.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="ColumnHeaderCompleteTemplate">
                <FontIcon
                    Margin="0,3,0,0"
                    FontSize="16"
                    Glyph="&#xE73E;" />
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>
    <Grid  x:Name="ContentArea" Margin="{StaticResource SmallTopBottomMargin}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Margin="0 5 0 5">
            <TextBlock x:Uid="SearchUser" Style="{ThemeResource SubtitleTextBlockStyle}"/>
            <Border BorderThickness=".5" BorderBrush="LightGray" CornerRadius="2">
                <Grid Margin="0 5 0 5" HorizontalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <StackPanel>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock x:Uid="UserNameText"
                                       Grid.Row="0"
                                       Grid.Column="0"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"
                                       Margin="2 0 5 0"/>
                            <TextBox x:Uid="UserNameNullText"
                                     Grid.Row="1"
                                     Grid.Column="0"
                                     HorizontalAlignment="Left"
                                     Margin="0 0 5 0"
                                     Width="200"
                                     Text="{x:Bind ViewModel.UserName, Mode=TwoWay}"/>
                            <TextBlock Grid.Row="0" x:Uid="UserEmailText"
                                       Grid.Column="1"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"
                                       Margin="0 0 5 0"/>
                            <TextBox x:Uid="UserEmailNullText"
                                     Grid.Row="1"
                                     Grid.Column="1"
                                     HorizontalAlignment="Left"
                                     Width="200"
                                     Text="{x:Bind ViewModel.UserEmail, Mode= TwoWay}"/>
                            <TextBlock x:Uid="UserRoleText"
                                       Grid.Row="0"
                                       Grid.Column="2"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center"
                                       Margin="5 0 2 0"/>
                            <SplitButton Grid.Row="1"
                                         Grid.Column="2"
                                         Margin="5 0 5 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                    </StackPanel>
                                </StackPanel>
                                <SplitButton.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserRoles" ItemsSource="{x:Bind ViewModel.UserRoles, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserRoles.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </SplitButton.Flyout>
                            </SplitButton>
                            <TextBlock x:Uid="UserDepartmentText"
                                       Grid.Row="0"
                                       Grid.Column="3"
                                       VerticalAlignment="Center"
                                       Margin="2 0 5 0"/>
                            <SplitButton Grid.Row="1"
                                         Grid.Column="3"
                                         Margin="0 0 5 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                    </StackPanel>
                                </StackPanel>
                                <SplitButton.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserDepartments" ItemsSource="{x:Bind ViewModel.UserDepartments, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserDepartments.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </SplitButton.Flyout>
                            </SplitButton>
                            <TextBlock x:Uid="UserFunctionsText"
                                       Grid.Row="0"
                                       Grid.Column="4"
                                       VerticalAlignment="Center"
                                       Margin="2 0 5 0"/>
                            <SplitButton Grid.Row="1"
                                         Grid.Column="4"
                                         Margin="0 0 5 0" HorizontalAlignment="Stretch">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Select"
                                                   Margin="0 0 10 0" />
                                    </StackPanel>
                                </StackPanel>
                                <SplitButton.Flyout>
                                    <Flyout Placement="Bottom">
                                        <StackPanel Orientation="Vertical">
                                            <ListView x:Name="UserFunctions" ItemsSource="{x:Bind ViewModel.UserFunctions, Mode=OneWay}"
                                                      SelectionMode="Multiple"
                                                      VerticalContentAlignment="Top"
                                                      ScrollViewer.IsVerticalRailEnabled="True"
                                                      ScrollViewer.VerticalScrollBarVisibility="Visible">
                                                <i:Interaction.Behaviors>
                                                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                                                        <ic:InvokeCommandAction
                                                            Command="{x:Bind ViewModel.SelectedItemsCommand}"
                                                            CommandParameter="{x:Bind UserFunctions.SelectedItems,Mode=OneWay}"/>
                                                    </ic:EventTriggerBehavior>
                                                </i:Interaction.Behaviors>
                                            </ListView>
                                        </StackPanel>
                                    </Flyout>
                                </SplitButton.Flyout>
                            </SplitButton>
                            <TextBlock Text="User Status"
                                       Grid.Row="0"
                                       Grid.Column="5"
                                       VerticalAlignment="Center"
                                       Margin="5 0 5 0"/>
                            <ComboBox Grid.Row="1" Grid.Column="5" Height="30"
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Center"
                                      ItemsSource="{x:Bind ViewModel.UserStatus}"
                                      SelectedItem="{x:Bind ViewModel.SelectedUserStatus, Mode=TwoWay}"/>
                            <Button Grid.Row="0"
                                    Grid.Column="10"
                                    Margin="2 0 0 0"
                                    Command="{x:Bind ViewModel.SearchCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="SearchButtonText"
                                               Margin="0 0 10 0" />
                                    <SymbolIcon Symbol="Zoom"/>
                                </StackPanel>
                            </Button>
                            <Button Grid.Row="1"
                                    Grid.Column="9"
                                    Command="{x:Bind ViewModel.AddUserCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="CreateNewButtonText" Margin="0 0 15 0"/>
                                    <SymbolIcon Symbol="AddFriend"/>
                                </StackPanel>
                            </Button>
                            <Button Grid.Row="1"
                                    Grid.Column="10"
                                    Margin="5 0 0 0"
                                    Command="{x:Bind ViewModel.ClearCommand}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Uid="ClearButtonText" Margin="0 0 20 0"/>
                                    <SymbolIcon Symbol="Refresh"/>
                                </StackPanel>
                            </Button>
                        </Grid>
                    </StackPanel>
                </Grid>
            </Border>
        </StackPanel>
        <Grid Grid.Row="1" Margin="0 5 0 5">
            <Grid.RowDefinitions>
                <RowDefinition MinHeight="192"
                               Height="*"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <telerikGrid:RadDataGrid x:Name="UserGrid"
                                     ItemsSource="{x:Bind ViewModel.Source}"
                                     AutoGenerateColumns="False"
                                     RowHeight="25"
                                     SelectionMode="Multiple"
                                     SelectionUnit="Row"
                                     UserGroupMode="Disabled">
                <i:Interaction.Behaviors>
                    <ic:EventTriggerBehavior EventName="SelectionChanged">
                        <ic:InvokeCommandAction
                            Command="{x:Bind ViewModel.SelectedUsersCommand}"
                            CommandParameter="{x:Bind UserGrid.SelectedItems,Mode=OneWay}"/>
                    </ic:EventTriggerBehavior>
                </i:Interaction.Behaviors>
                <telerikGrid:RadDataGrid.Columns>
                    <telerikGrid:DataGridTemplateColumn SizeMode="Fixed" Width="20">
                        <telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                            <DataTemplate>
                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <CheckBox/>
                                </StackPanel>
                            </DataTemplate>
                        </telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                    </telerikGrid:DataGridTemplateColumn>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="UserName" Header="Name"/>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="UserEmail" Header="Email"/>
                    <telerikGrid:DataGridTextColumn SizeMode="Auto"  PropertyName="DepartmentName" Header="Department"/>
                    <telerikGrid:DataGridBooleanColumn SizeMode="Auto" PropertyName="UserActiveIndicator" Header="User Status" />
                    <telerikGrid:DataGridDateColumn SizeMode="Auto" PropertyName="RecordCreated" Header="Date Created" CellContentFormat="{}{0:d}"/>
                    <telerikGrid:DataGridDateColumn SizeMode="Auto" PropertyName="RecordModified" Header="Date Modified" CellContentFormat="{}{0:d}"/>
                </telerikGrid:RadDataGrid.Columns>
            </telerikGrid:RadDataGrid>
            <telerikPrimitives:RadGridSplitter Grid.Row="1"
                                               ResizeBehavior="BasedOnAlignment"
                                               ResizeDirection="Rows"
                                               HorizontalAlignment="Stretch">
                <telerikPrimitives:RadGridSplitter.Element>
                    <FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE76F;" FontSize="10"/>
                </telerikPrimitives:RadGridSplitter.Element>
            </telerikPrimitives:RadGridSplitter>
            <Grid Grid.Row="2" Margin="0 2 0 0">
                <telerik:RadTabControl>
                    <telerik:RadTabControl.Items>
                        <telerik:RadTabItem Header="User Details">
                            <telerik:RadTabItem.Content>
                                <controls:AddEditControl x:Name="AddEditControl" DataContext="{x:Bind ViewModel.UserDetailsViewModel}" />
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                        <telerik:RadTabItem Header="Tab 2" Content="The content of tab item 2"/>
                        <telerik:RadTabItem Header="Tab 3" Content="The content of tab item 3"/>
                        <telerik:RadTabItem Header="Tab 4" Content="The content of tab item 4"/>
                    </telerik:RadTabControl.Items>
                </telerik:RadTabControl>
            </Grid>
        </Grid>
    </Grid>
</Page>

0
Masha
Telerik team
answered on 26 Sep 2022, 09:47 AM

Hello Boris,

As I understand you want always initially 6 rows of DataGrid to be shown. If this is right, please try to set RowDefinitions as follows:

 <Grid.RowDefinitions>
    <RowDefinition MinHeight="192"
                   Height="*"/>
    <RowDefinition Height="10"/>
    <RowDefinition Height="4*"/>
</Grid.RowDefinitions>

Please let me know if this suggestion works for you.

Regards,
Masha
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DataGrid GridSplitter TabControl
Asked by
Boris
Top achievements
Rank 1
Answers by
Vicky
Telerik team
Masha
Telerik team
Share this question
or