Page 1 of 1

Foreground not passed down the tree?

Posted: 22 Mar 2021, 20:34
by Sybaris
I've just created a menu with a couple of menu items below it. On the menu tag itself I've set Foreground="Magenta" and I expected that all the menu items would then be displayed in magenta but they stay the way they were before.
I'm using the Noesis project template and that allows me to run the WPF application in parallel where all the items are magenta - as I would expect from WPF.
Am I doing something wrong?

Thanks in advance!

Günther

Re: Foreground not passed down the tree?

Posted: 22 Mar 2021, 20:48
by Sybaris
I've just tried it with the free Noesis GUI 2.1 and there the Foreground property is correctly passed down the tree.
So this seems to have changed between Noesis 2 and 3, right?
So Noesis 3 is moving away from WPF standards?
Anyway, I'll stay with 2.1 then.

Re: Foreground not passed down the tree?

Posted: 23 Mar 2021, 11:38
by sfernandez
Hi, we try not to deviate from WPF, so this is something we should change.

The foreground brush is specified in the style for the MenuItem in Noesis theme. It is strange because in Blend if you create a Menu with some menu items the Foreground is inherited from the Menu as you said. But if you select the MenuItem and click on "Format > Edit Style > Edit a Copy..." it creates a style that defines a setter for the Foreground property and it is not inheriting the foreground from the Menu anymore. We used those copies as references to create our theme styles.

Could you please report it in our bugtracker, we will fix it in a future release.

In the meantime you can override the style for the menu items like this:
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
  <Setter Property="Foreground" Value="Magenta">
</Style>

Re: Foreground not passed down the tree?

Posted: 24 Mar 2021, 01:58
by jsantos
So Noesis 3 is moving away from WPF standards?
This is related to the new theme added in 3.0. Thanks for reporting this, please, as mentioned above, open a ticket if needed.

Re: Foreground not passed down the tree?

Posted: 24 Mar 2021, 10:21
by Sybaris
Thanks for your reply.
Bug created.