AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.95k stars 2.17k forks source link

How to fix DataGridHeader style #14052

Open ntprohd opened 7 months ago

ntprohd commented 7 months ago

Describe the bug

Separator of DataGridColumnHeader will clipped by header bound.

Theme

FluentTheme

Screenshots

If applicable, add screenshots to help explain your problem. Screenshot_1

Environment

Code

<DataGrid Grid.Row="0" IsReadOnly="True" CornerRadius="3"
                      ItemsSource="{Binding Offers}"
                      GridLinesVisibility="All"
                      AutoGenerateColumns="False"
                      BorderThickness="1"
                      BorderBrush="Gray"
                      HorizontalAlignment="Stretch">
                <DataGrid.Resources>
                    <x:Double x:Key="DataGridSortIconMinWidth">0</x:Double>
                </DataGrid.Resources>
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name" Width="*" Binding="{Binding Name}"/>
                    <DataGridTextColumn Header="Link" Width="*" Binding="{Binding Link}"/>
                    <DataGridTextColumn Header="Limit" Width="*" Binding="{Binding Limit}"/>
                    <DataGridTextColumn Header="Thread" Width="*" Binding="{Binding Thread}"/>
                    <DataGridTextColumn Header="Delay" Width="*" Binding="{Binding Delay}"/>
                    <DataGridTextColumn Header="User Agent" Width="*" Binding="{Binding UserAgent}"/>
                    <DataGridTextColumn Header="Tools" Width="*" Binding="{Binding Tools}"/>
                    <DataGridTextColumn Header="Proxy" Width="*" Binding="{Binding Proxy}"/>
                    <DataGridTextColumn Header="Language" Width="*" Binding="{Binding Language}"/>
                    <DataGridTextColumn Header="Referrer" Width="*" Binding="{Binding Referrer}"/>
                    <DataGridTextColumn Header="Auto Start" Width="*" Binding="{Binding TimeAutoStart}"/>
                    <DataGridTextColumn Header="Auto Stop" Width="*" Binding="{Binding TimeAutoStop}"/>
                    <DataGridCheckBoxColumn Header="Auto Fake" Width="*" Binding="{Binding AutoFake}"/>
                    <DataGridTextColumn Header="Network" Width="*" Binding="{Binding Network}"/>
                    <DataGridTextColumn Header="Running" Width="*" Binding="{Binding Running}"/>
                    <DataGridTextColumn Header="Success" Width="*" Binding="{Binding Success}"/>
                    <DataGridTemplateColumn Header="Start" Width="*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Content="Start" Margin="2" Background="{Binding BgStart}" Foreground="{Binding FgStart}" Command="{Binding ((vm:MainWindowViewModel)DataContext).StartOfferCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Stop" Width="*" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Content="Stop" Margin="2" Background="{Binding BgStop}" Foreground="{Binding FgStop}" Command="{Binding ((vm:MainWindowViewModel)DataContext).StopOfferCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Edit" Width="*" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate x:DataType="vm:MainWindowViewModel">
                                <Button Content="Edit" Margin="2" Command="{Binding ((vm:MainWindowViewModel)DataContext).EditOfferCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Delete" Width="*" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate x:DataType="vm:MainWindowViewModel">
                                <Button Content="Delete" Margin="2" Command="{Binding ((vm:MainWindowViewModel)DataContext).DeleteOfferCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
</DataGrid>
thevortexcloud commented 7 months ago

It's probably worth mentioning what theme you are using.

ntprohd commented 7 months ago

It's probably worth mentioning what theme you are using.

i am using FluentTheme

timunie commented 7 months ago

@thevortexcloud I guess it's a rounding issue. We had some similar fixed earlier

RentonIssac commented 5 months ago

web had same issue here.

maxkatz6 commented 5 months ago

I think it was already fixed on nightly builds. Can somebody check?

RentonIssac commented 5 months ago

Not fixed yet in version: 11.0.9 I didn't see any commit about this issue by now.

timunie commented 5 months ago

@maxkatz6 it's still present in case you use Width="*". Tested using nightly.

RentonIssac commented 3 months ago

bump

2 different resolution / DPI monitors help representing issue.

RentonIssac commented 3 months ago

it's still present. Tested using nightly.

dif-sam commented 2 months ago

As possible workaround, you may set property UseLayoutRounding to False in the style for DataGridColumnHeader.