How to bind a static value?

I have MultiBinding, with 1 binding, I want to use a static value, for example. 1 or 0.33, how can I do this? also when I am, I want to bind the value 1/3 = 0.33333 ... Can I get the expression?

<!-- not correct syntax, but something like this is what I want to acheive -->
<Binding Value="1" />

UPDATE

I tried something like

<Binding Path="NonExistantValue" FallbackValue="0" />

But it fails ... in a "clean" application it works ...

+3
source share
2 answers

Apparently, since 2009 there is a new way to do this. See the answer "Built-in types" in this link

0
source

Ah, I found the answer

<!-- in resources -->
<sys:Single x:Key="Single0">0</sys:Single>

<!-- in multibinding -->
<Binding Source="{StaticResource Single0}" />

I am confused, why Singleis float, why is the difference in names?

0

Source: https://habr.com/ru/post/1773475/


All Articles