Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Border Style Causes Unexpected Borders in DataGrid Column Headers #3788

Open
luckyandy0714 opened this issue Feb 8, 2025 · 1 comment
Labels
bug evaluation required Items is pending review or evaluation by the team

Comments

@luckyandy0714
Copy link

luckyandy0714 commented Feb 8, 2025

Bug explanation

When I added a global Border style in App.xaml:

Image

It caused unexpected borders to appear at both ends of the DataGrid's ColumnHeader:

Image

I tried adjusting any possible Border settings within the DataGrid, such as modifying the BorderThickness of the DataGridColumnHeader, but none of them worked.
I'm not sure if this is a bug or if there's another setting that can override the DataGrid's internal borders to prevent them from being affected by the global Border style.

Version

5.2.1

@luckyandy0714 luckyandy0714 added bug evaluation required Items is pending review or evaluation by the team labels Feb 8, 2025
@corvinsz
Copy link
Member

corvinsz commented Feb 8, 2025

@luckyandy0714 defining a global implicit style for basic controls like the Border is not a good idea.
Amongst other controls - like Grids - Borders are used almost everywhere within the MDIX styles.

Your best bet is probably to give the style an x:Key and reference it via the key whenever you need it. If applicable you can then also set the style as a implicit style at a more deeper level (rather than the app level), e.g.:

<UserControl ...>
    <UserControl.Resources>
        <Style TargetType="{x:Type Border}" BasedOn="{StaticResource MyCustomBorderStyle}"/>
    </UserControl.Resources>
    ...
</UserControl>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation required Items is pending review or evaluation by the team
Projects
None yet
Development

No branches or pull requests

2 participants