-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modernize TemplateControl template
- Loading branch information
1 parent
66f3823
commit 43b4664
Showing
4 changed files
with
62 additions
and
15 deletions.
There are no files selected for viewing
36 changes: 29 additions & 7 deletions
36
templates/csharp/templatedcontrol/NewTemplatedControl.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:AvaloniaAppTemplate.Namespace"> | ||
<Design.PreviewWith> | ||
<controls:NewTemplatedControl /> | ||
|
||
<StackPanel Width="400" MinHeight="400"> | ||
<ThemeVariantScope RequestedThemeVariant="Default"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
<ThemeVariantScope RequestedThemeVariant="Light"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
<ThemeVariantScope RequestedThemeVariant="Dark"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
</StackPanel> | ||
</Design.PreviewWith> | ||
|
||
<Style Selector="controls|NewTemplatedControl"> | ||
<!-- Set Defaults --> | ||
<ResourceDictionary.ThemeDictionaries> | ||
<ResourceDictionary x:Key="Default"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="Black"/> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Light"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="Black"/> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Dark"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="White"/> | ||
</ResourceDictionary> | ||
</ResourceDictionary.ThemeDictionaries> | ||
|
||
<ControlTheme x:Key="{x:Type controls:NewTemplatedControl}" TargetType="controls:NewTemplatedControl"> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<TextBlock Text="Templated Control" /> | ||
<TextBlock Text="Templated Control" Foreground="{DynamicResourceKey MyForegroud}" /> | ||
</ControlTemplate> | ||
</Setter> | ||
</Style> | ||
</Styles> | ||
</ControlTheme> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 29 additions & 8 deletions
37
templates/fsharp/templatedcontrol/NewTemplatedControl.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:AvaloniaAppTemplate.Namespace"> | ||
<Design.PreviewWith> | ||
<controls:NewTemplatedControl /> | ||
<Design.PreviewWith> | ||
<StackPanel Width="400" MinHeight="400"> | ||
<ThemeVariantScope RequestedThemeVariant="Default"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
<ThemeVariantScope RequestedThemeVariant="Light"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
<ThemeVariantScope RequestedThemeVariant="Dark"> | ||
<controls:NewTemplatedControl /> | ||
</ThemeVariantScope> | ||
</StackPanel> | ||
</Design.PreviewWith> | ||
|
||
<Style Selector="controls|NewTemplatedControl"> | ||
<!-- Set Defaults --> | ||
<ResourceDictionary.ThemeDictionaries> | ||
<ResourceDictionary x:Key="Default"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="Black"/> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Light"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="Black"/> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Dark"> | ||
<SolidColorBrush x:Key="MyForegroud" Color="White"/> | ||
</ResourceDictionary> | ||
</ResourceDictionary.ThemeDictionaries> | ||
|
||
<ControlTheme x:Key="{x:Type controls:NewTemplatedControl}" TargetType="controls:NewTemplatedControl"> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<TextBlock Text="Templated Control" /> | ||
<TextBlock Text="Templated Control" Foreground="{DynamicResourceKey MyForegroud}" /> | ||
</ControlTemplate> | ||
</Setter> | ||
</Style> | ||
</Styles> | ||
</ControlTheme> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters