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

Devtools reporting wrong style precedence #17598

Open
DSPaul opened this issue Nov 23, 2024 · 0 comments
Open

Devtools reporting wrong style precedence #17598

DSPaul opened this issue Nov 23, 2024 · 0 comments

Comments

@DSPaul
Copy link

DSPaul commented Nov 23, 2024

Describe the bug

Starting with update 11.2, in de devtools, the wrong style is crossed out.
I made a simple reproduction with a green button. (see further for code)
You can see that in 11.1, it rightfully crossed out red.
Starting from 11.2, the button is still green, but in de devools, green is now crossed out instead of red.
afbeelding

To Reproduce

Can be reproduced with the following code:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="StylePriorityBug.MainWindow"
        Title="StylePriorityBug">
  
  <Window.Styles>
    <Style Selector="Button">
      <Setter Property="Background" Value="Green"/>
    </Style>
  </Window.Styles>
  
  <Window.Resources>
    <ControlTheme TargetType="Button" x:Key="MyButtonTheme">
      <Setter Property="Background" Value="Red"/>
      <Setter Property="Template">
        <ControlTemplate TargetType="Button">
          <Border Background="{TemplateBinding Background}">
            <TextBlock Text="{TemplateBinding Content}"/>
          </Border>
        </ControlTemplate>
      </Setter>
    </ControlTheme>
  </Window.Resources>
  
  <Button Content="This button is green" 
          Theme="{StaticResource MyButtonTheme}"/>
</Window>

Expected behavior

The devtools should strike through the styles that were overwriten by a higher priority style.

Avalonia version

11.2.0

OS

Windows

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants