You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this should be supported by the compiler, because markup extensions have allocation overhead.
Describe alternatives you've considered
Here is how our And and Or markup extensions look:
public class Or : MarkupExtension
{
private readonly IBinding[] _bindings;
public Or(object b1, object b2)
{
if (b1 is not IBinding bind1 ||
b2 is not IBinding bind2)
{
throw new BindingChainException("'Or' MarkupExtension binging error");
}
_bindings = new[] { bind1, bind2 };
}
public Or(object b1, object b2, object b3)
{
if (b1 is not IBinding bind1 ||
b2 is not IBinding bind2 ||
b3 is not IBinding bind3)
{
throw new BindingChainException("'Or' MarkupExtension binging error");
}
_bindings = new[] { bind1, bind2, bind3 };
}
//here was ctors for 4-7 elements
public override object ProvideValue(IServiceProvider serviceProvider) => new MultiBinding
{
Converter = BoolConverters.Or,
Bindings = _bindings
};
}
And looks the same as Or
Additional context
We have 275 multibindings in our codebase. All of them using markup extension style over <multibinding> style for making a markup code smaller, 10x easier to read - and this is a real benefit in a complex markups.
The text was updated successfully, but these errors were encountered:
my proposal is easier to implement because parsing is not an issue, and already supported by analysis of a rider.
also my proposal can combine different types of Bindings... TemplateBinding, maybe x:Static, and Static/DynamicResource...
Is your feature request related to a problem? Please describe.
To have a nice xaml we use {And} and {Or} markup extensions, that support bindings, etc. Here is an example:
Also it supports nesting:
Describe the solution you'd like
I think this should be supported by the compiler, because markup extensions have allocation overhead.
Describe alternatives you've considered
Here is how our
And
andOr
markup extensions look:And looks the same as Or
Additional context
We have 275 multibindings in our codebase. All of them using markup extension style over
<multibinding>
style for making a markup code smaller, 10x easier to read - and this is a real benefit in a complex markups.The text was updated successfully, but these errors were encountered: