开发者

How do you bind to dynamic content in wpf?

My Situation put simply is that if i have a textbox, lets call it A. when i update the value in this text box it should update a label - B. when B changes then it should update another label C.

so, effectively i wish to emply binding in the form of C bind to B which binds to A.

i have tried the following but C never gets updated.

    <TextBox Grid.Row="0" Name="A"/>        
    <Label Grid.Row="开发者_运维百科1" Name="B" Content="{Binding Text, ElementName=A, UpdateSourceTrigger=PropertyChanged}"/>
    <Label Grid.Row="2" Name="C" Content="{Binding Text, ElementName=B}"/>


Try it like this:

<TextBox Grid.Row="0" Name="A"/>
<Label Grid.Row="1" Name="B" Content="{Binding Text, ElementName=A}"/>
<Label Grid.Row="2" Name="C" Content="{Binding Content, ElementName=B}"/>

You have to bind to the Content property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜