Hi I wonder how can I create a Button with no styles. When I create a button take the style of the Theme Basic (with color, shadows, etc…). There is a way to create a clean button? I can change all the attributes less the background Color. Always overrides the default settings.
Make a Style
that defines Button
to have no properties or appearance, and set ux:Cascade="false"
to diasable general styling for that class.
<Style>
<Button ux:Cascade="false" />
</Style>
<Button Text="I'm FREEE!!" />
Yes, you can do this either by using other Styles/Themes for a subtree in UX or an inline style for a subtree.
So if you want a clean button or a button with another style, you can do this:
<StackPanel>
<Style>
<Button ux:Cascade="false" />
</Style>
</StackPanel>
Now all the Button’s in the StackPanel and its subtree will get this style applied. The ux:Cascade="false"
attribute stops the style from cascading, otherwise all the visible styles for button in the given subtree would have been concatenated.
You can also use Style/Theme objects this way:
<App>
<Fuse.BasicTheme.BasicTheme ColorScheme="Amber" />
<DockPanel>
<NavigationBar DockPanel.Dock="Top">
<Fuse.BasicTheme.BasicTheme ColorScheme="Red" />
</NavigationBar>
</DockPanel>
</App>
In this app everything in the NavigationBar will get the Red version of BasicTheme, and the rest will get Amber
More example code:
<StackPanel>
<Style>
<Button ux:Cascade="false">
<Rectangle ux:Binding="Appearance">
<LinearGradient>
...
</LinearGradient>
</Rectangle>
<Pressing>
<Scale ...
</Pressing>
<Hovering...
</Button>
</Style>
</StackPanel>