question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing the Foreground Brush of PathIcon does Nothing

See original GitHub issue

Describe the bug

Within Avalonia itself, changing the Foreground color of the ComboBox’s DropDownGlyph PathIcon in Fluent theme does nothing.

See: https://github.com/AvaloniaUI/Avalonia/pull/7837#discussion_r830514883

Strangely this does not work. I can change Data property here just fine but the Foreground property is ignored completely. I can set it to Red here and there will be no effect.

If the Foreground is set above in the PathIcon declaration it works fine. If Foreground is set within the template of PathIcon itself it works fine. I can’t imagine what priority-type issue is causing the issue here…

This is a big problem in my opinion and I’ve already seen that it affects SplitButton as well. I’m unsure where the issue is and will need someone from the core team to confirm. My guess is the priority of the properties isn’t being set correctly for Foreground somehow. I also could be missing something simple…

To Reproduce

  1. Go to ComboBox.xaml in the Fluent theme
  2. Modify the “Normal State” as below. The Foreground is now set to Red
     <Style Selector="ComboBox /template/ PathIcon#DropDownGlyph">
       <Setter Property="Foreground" Value="Red" />
       <Setter Property="Data" Value="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
     </Style>
    
  3. Run ControlCatalog. The DropDownGlyph color does not change.
  4. Note that if you modify Data it will be updated just fine.

Expected behavior

The color should change.

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

Desktop (please complete the following information):

  • OS: Windows
  • Version: Latest master as of 22-Mar-2022

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
amwxcommented, Mar 23, 2022

It’s actually a simple fix: In FluentControls.xaml, move the <StyleInclude> for PathIcon to the top. The problem is PathIcon declared in ComboBox is being overwritten when the actual PathIcon file loads - there’s a comment in there about ToolTip too. Personally I don’t like the templated icons thing for reasons I’m not gonna get into here, but that at least with the current styling system, template load order matters image

1reaction
maxkatz6commented, Jun 9, 2022

@alexanderdeman are you using stable version? This issue was related to nightly builds only. In the stable version you do it with different selector, check out default styles: https://github.com/AvaloniaUI/Avalonia/blob/stable/0.10.x/src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml#L198-L200

  <Style Selector="ComboBox /template/ Path#DropDownGlyph">
    <Setter Property="Fill" Value="Red" />
  </Style>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Binding Path Fill to Button Foreground in ContentPresenter
And brushes in the as resources will always be in one place, changing them in this place, all the elements of their pick...
Read more >
Odd problem with "stroke path"
I set the foreground color, choose the brush, hit the stroke path icon in the paths dialog and as soon as the menu...
Read more >
PathIcon Class (Windows.UI.Xaml.Controls) - UWP
Gets or sets a brush that describes the foreground color. (Inherited from IconElement). Height. Gets or sets the suggested height of a FrameworkElement....
Read more >
Re: Stroke path is not working PLEASE HELP?!?!?!
Step 1: Draw a path using the pen curvature tool. Step 2: Choose the brush tool and click on the work plane. Photoshop...
Read more >
Building a Profile Page with Uno Platform for Figma - Blog
Open the Icon Layer, and you can change the instance in the right-hand pane. Select the IconButton. Add a Fill color in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found