ConverterParameter with Binding on Multibinding
is it possible to add a Binding to a ConverterParameter in a MultiBinding? Something like this:
<HierarchicalDataTemplate DataType="{x:Type Elements:RootElement}">
<HierarchicalDataTemplate.ItemsSource>
<MultiBinding Converter="{StaticResource filterConverter}" ConverterParameter="{Binding IsFilterd}">
<Binding Path="Children"/>
<Binding Path="FilterChildren"/>
</MultiBinding>
</HierarchicalDataTemplate.ItemsSource>
<TextBlock Text="{Binding Name}" FontWeight="Normal"/>
</HierarchicalDataTemplate>
Where IsFiltered is a Property on the Object that the Template is applied on. I always get an XAML parser error that the Binding is not correct/allowed in ConverterParameter... Or is there some other way to do this??
Gr开发者_运维知识库eets,
Jürgen
ConverterParameter is not a DependencyProperty, and therefore databinding can't work on it.
Why not add another Binding to the MultiBinding? send the IsFiltered as another value:
<MultiBinding Converter="{StaticResource filterConverter}" >
<Binding Path="Children"/>
<Binding Path="FilterChildren"/>
<Binding Path="IsFiltered" />
</MultiBinding>
Just add the ConverterParameter the way I did it in the code below, if you have plain text to pass to the multiconverter.
<MultiBinding Converter="{StaticResource SortingDirectionImageMultiConverter}">
<Binding Path="SortingColumnIdentifier"/>
<Binding Path="IsSortingAscending"/>
<MultiBinding.ConverterParameter>txtBlockConfigNumber</MultiBinding.ConverterParameter>
</MultiBinding>
精彩评论