-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Theme property #294
Comments
Seems like the |
Sure, I can try for sure. Right now, I was able to add the following function:
However, I'm not sure I've found the cleanest / easiest way to retrieve the theme resource, any suggestions?
|
Nice 👍 Dealing with resources that need to be looked up is always a bit hairy. Having a control that's described with the following code also means that the Border.create [
Border.theme ((ctx.control.FindResource("CardBorder")) :?> ControlTheme)
] Another way of setting the theme would be: Border.create [
Border.init (fun border ->
border.Theme <- ((ctx.control.FindResource("CardBorder")) :?> ControlTheme)
)
] If you create a PR I'll merge the binding you created. 👍 |
Would |
@JaggerJo thanks for the suggestion, make sense to use the init! I was thinking at maybe creating a centralized place when all styles are defined and available. I don't really like the fact that right now I'm relying of a string as well, maybe a TypeProvider could be created for the purpose, but this is way to far from my current f# knowledge 😃 @Numpsy make sense, I've made the suggested change! In all cases, PR created 😄 |
There have been attempts at xaml type providers before (e.g. https://github.com/fsprojects/FsXaml) but I don't know about usage with Avalonia (I once made one attempt at an F# WPF project using the type provider for generating bindings from xaml and couldn't get it to work, and that's about the limit of my knowledge) |
@melursus23 merged 👌 thanks for the contribution. |
Hello,
How can I set the "Theme" property using your library?
I'm trying to mimic something similar to this but there is no
Border.theme
:https://github.com/irihitech/Semi.Avalonia/blob/922afa904b36b4b70669d9156e4f570bfffaebf4/demo/Semi.Avalonia.Demo/Pages/BorderDemo.axaml
The text was updated successfully, but these errors were encountered: