user2205565
user2205565

Reputation: 41

winrt textblock run binding designtime

my datacontext in designtime

d:DataContext="{d:DesignInstance Type=viewmodel:MainViewModel, IsDesignTimeCreatable=True}"
....
<TextBlock Text="{Binding Path=Driver}">

work fine. Only in:

<TextBlock/>
    <Run Text="{Binding Path=Jahr}" />
</TextBlock>

dont work in designtime, why?

Upvotes: 2

Views: 915

Answers (2)

Tristan Warner-Smith
Tristan Warner-Smith

Reputation: 9781

NOTE: It IS possible to bind to a <Run /> but it won't render at Design-Time, only Run-time.

This works a treat for binding.

    <TextBlock>
        <Run Text="{Binding Results.Count}" />
        <Run Text=" results for '" />
        <Run Text="{Binding SearchTerm}" />
        <Run Text="'"/>
    </TextBlock>

You can't set the TextBlock Text AND a Run Binding though. It's either one or the other, this works fine, but doesn't render at design time as you say.

Upvotes: 4

Viktor Hofer
Viktor Hofer

Reputation: 380

Runs do support binding in Windows Runtime but it seems that those Run Controls do not support design time data... :-(

Upvotes: 2

Related Questions