First we need to add a reference of PresentationFramework.Royale.dll. Right click References and select "Add Reference".
The assembly should be available in .net tab:
After selecting this should be available in References folder:
After adding the reference, we should merge the resources in App.xaml.
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="/PresentationFramework.Royale;component/themes/Royale.NormalColor.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Now we can design our views. The theme should be automatically applied to the controls used in the application.
<Window x:Class="WPFComboBoxEditable.Window10"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{DynamicResource Data}"
Title="Window7" >
<Window.Resources>
<x:Array x:Key="Data" Type="{x:Type sys:String}">
<sys:String>First</sys:String>
<sys:String>Second</sys:String>
<sys:String>Third</sys:String>
</x:Array>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="100" />
<RowDefinition Height="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Row="0" Grid.Column="1"></TextBox>
<Button Grid.Row="1" Grid.Column="1">testttt</Button>
<ComboBox Visibility="Visible" Grid.Column="1"
Name="comboBox1" ItemsSource="{Binding}"
Grid.Row="2">
<ComboBox.SelectedIndex>-1</ComboBox.SelectedIndex>
</ComboBox>
</Grid>
</Window>
When we run the application, this should appear as follows:
Note:
If user personalize theme settings then those changes would also be updated to the application.
No comments:
Post a Comment