<Window.Resources>
<local:MultiplyConverter x:Key="MultiplyConverter"/>
</Window.Resources>
<Grid>
<StackPanel Orientation="Vertical">
<TextBox x:Name="TextBox" />
<!--Binding Path=Text是绑定的属性为Text-->
<!-- ElementName=TextBox 是绑定的元素的名称-->
<!--StaticResource MultiplyConverter 中的MultiplyConverter是资源字典中的key值-->
<TextBlock Text="{Binding Path=Text,
ElementName=TextBox,
Converter={StaticResource MultiplyConverter},
ConverterParameter=10}"/>
</StackPanel>
</Grid>
public class MultiplyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parame
转载请注明原文地址:https://blackberry.8miu.com/read-35712.html