I'm trying to set the Text
property of a TextBox
to an static property which of type double
. But obviously I'm getting an error:
Invalid member type: expected type is 'string' actual type is 'double'
because it only accepts an string. How can I fix this? And why I don't get this error when I Bind
to a non-static property which is also double
?
<TextBox Text="{x:Static building:Building.FoundationHeight}"/>
Building is an static class and FoundationHeight is static property of type double
.
Solution:
The question is a duplicate, I'll post the answer specific to this question here anyway:
<TextBox Text="{Binding Source={x:Static building:Building.FoundationHeight}, Mode=OneWay}"/>