- udayKolluru
- Posts: 2
- Joined:
Control Colors
Hi,
I am using trial version Of Noesis GUI 1.24 package . In unity 5.2.1
Here I am trying to change the Noesis Controls (color), Suppose if there is check Box, in it Check Mark is Blue I want To Change it red how can i Change it , I want to change all control colors as per requirement.
Can anybody help me to sort out this problem.
I am using trial version Of Noesis GUI 1.24 package . In unity 5.2.1
Here I am trying to change the Noesis Controls (color), Suppose if there is check Box, in it Check Mark is Blue I want To Change it red how can i Change it , I want to change all control colors as per requirement.
Can anybody help me to sort out this problem.
-
sfernandez
Site Admin
- Posts: 3184
- Joined:
Re: Control Colors
Control appearance is specified by its Template property, where a ControlTemplate defines the tree of visual elements that are shown for a type of control.
For example, a simple CheckBox template could be:
As you can see the color of each visual part is defined by the template elements. But you can bind some properties to the templated control, so changes in Control properties will modify the appearance of the template:
The last CheckBox will have the a green check mark instead.
For example, a simple CheckBox template could be:
Code: Select all
<CheckBox Content="Some check" HorizontalAlignment="Center" VerticalAlignment="Center">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<Border Background="Transparent">
<BulletDecorator>
<BulletDecorator.Bullet>
<Border x:Name="bd" BorderBrush="Black" BorderThickness="1"
Padding="1" Width="16" Height="16" VerticalAlignment="Center">
<Path x:Name="chk" Data="M0,0 L10,10 M0,10 L10,0"
Stroke="Red" StrokeThickness="2" Stretch="Fill"/>
</Border>
</BulletDecorator.Bullet>
<ContentPresenter VerticalAlignment="Center" Margin="8,0,0,0"/>
</BulletDecorator>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="WhiteSmoke"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="chk" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
Code: Select all
<CheckBox Content="Some check" HorizontalAlignment="Center" VerticalAlignment="Center"
BorderBrush="Green">
<CheckBox.Template>
...
<Path x:Name="chk" Data="M0,0 L10,10 M0,10 L10,0"
Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" Stretch="Fill"/>
...
</CheckBox.Template>
</CheckBox>
Re: Control Colors
By the way, all your templates can be shared in a separate XAML. There are several themes in the Unity package at Assets\NoesisGUI\Themes.
More information in the Styles and Templates Tutorial.
More information in the Styles and Templates Tutorial.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests