Binding Run inside Textblock throws exception in WPF

I am trying to link the two <Run>

internally TextBlock

as shown in the snippet below. But I am getting XamlParseException

.

Basically I am trying to achieve this format:

CodeNum: LongDescription

If the code below is doomed to fail, what other alternatives do I have?

<TextBlock>
    <Run FontWeight="Bold" Text="{Binding CodeNum}"/>
    <Run FontWeight="Bold" Text=": "/>
    <Run Text="{Binding LongDescription}"/>
</TextBlock>

      

+3


source to share


1 answer


I am assuming that either LongDescription

or CodeNumis

is a read-only property (does not have a public setter). You need to change the binding to be one way for all read-only properties you use inRun



<Run Text="{Binding LongDescription, Mode=OneWay}"/>

      

+12


source







All Articles