-
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
feat: modernize TemplateControl template #239
Conversation
<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> |
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.
9c57e43
to
c53b1d0
Compare
Can we remove dynamic resources / theme dictionaries at all? |
For the comment, instead of samples, let's add these documentation pages: |
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<TextBlock Text="Templated Control" /> | ||
<TextBlock Text="Templated Control" Foreground="{TemplateBinding Foreground}" /> |
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.
Why Foreground is here? It's an inherited property. In Avalonia controls we try to avoid redefining this property, where it can be inherited.
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.
It's just an indication for beginners of how it might be done.
Co-authored-by: Max Katz <maxkatz6@outlook.com>
1123cb4
to
e2028a4
Compare
I still think Foreground on TextBlock will only confuse users, as it should be inherited in third party libraries. |
But either way, this PR looks good to me overall, but can only be merged once we drop 0.10 from our templates. |
Styles
withResourceDictionary
ControlTheme
AddThemeDictionaries
ThemeVariantScope
inDesign.PreviewWith
Depended from AvaloniaUI/Avalonia.Samples#66