-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: modernize TemplateControl template #239
Merged
maxkatz6
merged 6 commits into
AvaloniaUI:master
from
workgroupengineering:features/modernize_templatedcontrol
Mar 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
43b4664
feat: modernize TemplateControl template
workgroupengineering c53b1d0
fix: Address review
workgroupengineering b71f1d1
fix: Address review
workgroupengineering e2028a4
fix: Address review
workgroupengineering c213abe
Merge remote-tracking branch 'upstream/master' into features/moderniz…
workgroupengineering 792e134
fix: Address review
workgroupengineering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we should have this in the templates.
I would rather add a comment with a link to the Avalonia.Samples, where we would have this.