纸上得来终觉浅,绝知此事要躬行。

 

WPF 依赖项属性[DependencyProperty]Text的绑定方式

方法一:

<TextBlock Style="{StaticResource NormalTextBlockStyle}" Width="80" FontWeight="Bold" Margin="25,5,5,5">
    <TextBlock.Text>
        <Binding Path="RechargeInfo.ZeroValue" StringFormat="{}{0:F2}" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"></Binding>
    </TextBlock.Text>
</TextBlock>

方法二:

<TextBlock Style="{StaticResource NormalTextBlockStyle}" Width="80" FontWeight="Bold" Margin="25,5,5,5"
    Text="{Binding Path = RechargeInfo.ZeroValue, Mode = TwoWay,UpdateSourceTrigger = PropertyChanged}">
</TextBlock>

posted on 2012-04-25 15:39  JRoger  阅读(702)  评论(0编辑  收藏  举报

导航