如何将两个数据传递给IValueConterter(对象vaue,对象参数)?

时间:2022-07-10 16:59:23
<TextBlock x:Name="txtContentMessage" Text="{Binding Text}" TextTrimming="CharacterEllipsis" 
TextWrapping="Wrap" Foreground="{Binding Entities,Converter={StaticResource ChangedColorToUrlConverter}}" MaxLines="3" Grid.Row="1">
</TextBlock>

Now, It just pass data to object value. So I also want to pass to object parameter

现在,它只是将数据传递给对象值。所以我也想传递给object参数

  • object value will be assigned by Entities.
  • 对象值将由实体分配。

  • object parameter will be assigned by Text.
  • 对象参数将由Text指定。

1 个解决方案

#1


0  

Use the ConverterParameter binding property

使用ConverterParameter绑定属性

<TextBlock x:Name="txtContentMessage" 
    Text="{Binding Text}" 
    TextTrimming="CharacterEllipsis" 
    TextWrapping="Wrap" 
    Foreground="{Binding Entities, ConverterParameter='PUT TEXT HERE', Converter={StaticResource ChangedColorToUrlConverter}}" 
    MaxLines="3" 
    Grid.Row="1" />

#1


0  

Use the ConverterParameter binding property

使用ConverterParameter绑定属性

<TextBlock x:Name="txtContentMessage" 
    Text="{Binding Text}" 
    TextTrimming="CharacterEllipsis" 
    TextWrapping="Wrap" 
    Foreground="{Binding Entities, ConverterParameter='PUT TEXT HERE', Converter={StaticResource ChangedColorToUrlConverter}}" 
    MaxLines="3" 
    Grid.Row="1" />