-
Notifications
You must be signed in to change notification settings - Fork 1.7k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Make XAML style writing more like CSS #288
Comments
You already can use css to customize your controls. Also xaml is based on xml, so it should have xml syntax |
You're kind of comparing apples to oranges here. Based on your "Expect version 1" your first style should look like this: <Style x:Key="Btn" TargetType="Button">
<Setter Property="Width" Value="60" />
<Setter Property="Height" Value="32" />
<Setter Property="Background" Value="#4C5EE9" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderRadius" Value="3" />
</Style>
<Button Style="{StaticResource Btn}" Content="Button" /> Now that's not really that bad. (For what it's worth, it would be great if Of course, BorderRadius isn't a property of Button. But what I suspect you're doing is you're trying to say "Look at all the stuff you have to do to change a template" but then what you show as "expected" does not look like it could result in a changed template. So kind of not really comparing fairly. Again, apples to oranges. But for sure, when you do have to create a new Template, it gets very verbose. If you wanna propose something that would make it less so, I think you would need to show something that looks like it could actually create a template.
Also, I don't wanna exactly, you know, go all "language wars" or anything, but in my opinion: |
Maybe you're right, but it would be nice if XAML opened up more property Settings, like rounded corners |
Oh for sure. As of 17763, I should note, "CornerRadius" is a property that's available on all Controls, and can be used for rounding corners. I think there's definitely room for improvement in what Styles can do as well. I think a big pain point is that it's extraordinarily hard to style just one part of a template. Like either the control author creates a bunch of "Inner" style properties, or you have to remake the whole template. Also, just XML verbosity is a thing in general. So here's to hoping that at least some verbosity can be mitigated a little. |
XAML just has too few properties available, hopefully more and more in the future, and I'm eager to give this UI framework a try |
What do yo mean “too few properties”? |
Some components have too few styles @VladislavAntonyuk |
But it is not an issue of XAML and adding CSS as you suggested, won't add more. As for corner radius there were a discussion to create ICorner interface which will be applied to all controls that support rounded corners |
I think you might need to go back and go over a few of the finer points on MAUI and Xamarin... One of the amazing parts about it is that nearly everything is extensible.... soooo if it doesn't have enough or the right bindings for you, boom add more and sub a pr on it... If it's solid and doesn't cause issue's then it will get incorporated into the base... And or I would take a look at css / xaml integrations and how they interact with each other... because there has been a long-standing prop on this that just never gained major traction in the community to make them a more linear feel. Furthermore, this MIGHT be the right time to revisit that or soon™ because of the roadmap of incorporation of bBlazor as a project type. But I will say that personally as a long-time Xamarin guy and it is the language of choice... If you are finding yourself doing ALOT of this stuff all over the place... you might need to think over a few things on page structure because unfortunately, the verbosity will not go away. I can think of a half dozen things that would go fubar lowering it, just due to the ways data binding's work.. |
Yes, I wanted XAML to open up more styles to components to reduce the amount of code |
And @JHeLiu rounded corners are suuuper cake... James Montemagno has a blog some were on them. And or you could just have elements x/y/z have rounded corners if you put together a layout/parody pack. See Visual = Material for some solid examples of layout/parody pack |
You incorrectly understand what xaml does. It is just a markup language. All component properties created in behind as BindableProperty which than used to setup native components in Renderers |
css and html are very Bad language!Because they are not rigorous |
@xzbaijj Yes. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Make XAML style writing more like CSS
I don't know if future versions have that design in mind
Let's say I want a button with rounded corners
// version now
// expect version 1
// expect version 2
The text was updated successfully, but these errors were encountered: