the principle of using multibinding: There is more than one data source ;
1. Requirements: In a need to display the content, the different parts to be processed differently, you can use multibinding
1 <TextBlock>2 <Textblock.text>3 <multibindingStringFormat="{}{0} {1} {2}">4 <BindingPath= "Downloadviewmodel.totaldevicecount" />5 <BindingPath= "Language"Converter="{StaticResource Lanconverter}"Converterparameter= "Problem"/>6 <BindingPath= "Downloadviewmodel.totaldevicecount"Converter="{StaticResource Numtopluralconverter}"Converterparameter= "Driver" />7 </multibinding>8 </Textblock.text>9 </TextBlock>
View Code
Use MultiBinding's StringFormat directly to handle
2. Requirements: Data sources are different, but need to use these data sources for judgment or processing
1 <Button.commandparameter>2 <multibindingConverter="{StaticResource Windowmulitconverter}">3 <BindingRelativeSource="{RelativeSource Ancestortype=window,ancestorlevel=1}"/>4 <Binding/>5 </multibinding>6 </Button.commandparameter>
View Code
Two examples of WPF using MultiBinding in XAML