akgulebubekir / Maui.DataGrid

DataGrid component for Maui
MIT License
250 stars 49 forks source link

Customize header #181

Open nk-alex opened 4 months ago

nk-alex commented 4 months ago

How could the header be customized? I have seen the property HeaderLabelStyle but I'm not able to figure out how to use it. Also, is it possible to customize the full appearance not just the label style? Something like DataGridColumn.HeaderTemplate

xky0007 commented 3 months ago

I found this from the read.me. But I'm also curious how to use HeaderLabelStyle.

<dg:DataGridColumn  PropertyName="Name">
    <dg:DataGridColumn.FormattedTitle>
         <FormattedString>
              <Span Text="Name" TextColor="White" FontSize="13" FontAttributes="Bold" />                           
         </FormattedString>
    </dg:DataGridColumn.FormattedTitle>
</dg:DataGridColumn>
xky0007 commented 3 months ago
    <ContentPage.Resources>

        <Style x:Key="header" TargetType="Label">
            <Setter Property="TextColor" Value="White" />
        </Style>
    </ContentPage.Resources>

Then use with HeaderLabelStyle="{StaticResource Key=header}"