-
Notifications
You must be signed in to change notification settings - Fork 697
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
Proposal: Enable basic expressions and calculations in XAML #1630
Comments
The Avalonia project already has some of these (such as negation). It might be useful to study the syntax. |
And let !true equal Collapsed on Visibility properties, of course. |
Exactly. And other common scenarios. General idea is reduce XAML hassle and verbosity. Thanks Jerry tha Nixon! |
It'd also be great to be able to call another function within the parameters to a function call within x:Bind. I thought I had filed another issue on that explicitly, but I can't find it now... |
Proposal: Enable basic expressions and calculations in XAML
Summary
I often want to bind to a value but need to make addition, subtraction, multiplication, division, negation, string concatenation or a different simple mathematical formula.
It would be great, that instead of creating and maintaining a gazillion converters, there should be a built-in set of syntax conventions, such as simple arithmetic functions, negation, and maybe other basic math stuff, like
Pow
etc.More advanced 2nd phase features would be type casting and conversion, calling a convert/convert back function in any .NET type (for instance
System.Convert
). Maybe there should be a general purpose converter for common cases, such asstring
orint
todouble
etc.Rationale
Here are some examples (not suggesting the actual syntax here):
But there should also be away to maintain
TwoWay
bindings, somehow.If you're considering this functionality, this feature should be discussed as well, the goal is to reduce verbosity so something like:
might be to verbose.
Scope
The text was updated successfully, but these errors were encountered: