Search code examples
xamarin.formsuwpwin-universal-appxamarin.uwp

Xamarin Form - How To set a style for MyToolkit.Controls.DataGrid in UWP


I'm developing the DMS windows UWP application In which I want to show a user information on DataGrid. For this I am using MyToolkit.Controls.DataGrid. I want to change the header size and give the border for header. I also want to change the list items font size. so any one have a full style for DataGrid. how to hide the DataGrid column ?


Solution

  • the header size and give the border for header.

    The header is object type that mean you could custom it's content. If you want to add border you could refer the following code. But MyToolkit does not support modify the header size.

    <controls:DataGridTextColumn
        Width="200"
        Binding="{Binding Lastname}"
        IsAscendingDefault="False"
        >
        <controls:DataGridTextColumn.Header>
            <Border BorderThickness="1" Padding="5,5,5,5" BorderBrush="Red" CornerRadius="5">
                <TextBlock Foreground="Green" Text="Lastname" />
            </Border>
    
        </controls:DataGridTextColumn.Header>
    </controls:DataGridTextColumn>
    

    change the list items font size

    If you just want to change the list items font size, you could edit DataGridTextColumn FontSize property.

    <controls:DataGridTextColumn
        Width="200"
        Binding="{Binding Firstname}"
        FontSize="25"
        Header="Firstname"
        />
    

    how to hide the DataGrid column ?

    Just set with property as 0.

    <controls:DataGridTextColumn
        Width="0"
        Binding="{Binding Firstname}"
        FontSize="25"
        Header="Firstname"             
        />