EDIT:
My former question also referred to commands, but as pointed out in a comment below, it was unnecessary and added noise.
This is more a XAML syntax question, so it is probably trivial. I would like to know how to pass a string literal as a value for a binding in WPF.
If the value is already known from the context in XAML, may its value simply be directly assigned to the binding, instead of using paths and other means? If so, what would the syntax be in that case?
<MultiBinding.Bindings>
<!-- First binding, a textbox -->
<Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type TextBox}}"/>
<!-- Second binding, I want to pass a string as is, for instance, "Description" -->
<!-- The proper syntax for the line below is what I am after -->
<Binding Value="Description"/>
</MultiBinding.Bindings>
It's
<Binding Source="Description"/>
Source
can be any type, so in attribute syntax that is interpreted as a string, if no Path
is specified a binding's value is the source.
Also that is a multi-binding, i would not talk about command parameters as that is irrelevant to the matter...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With