के साथ एक MulitBinding का उपयोग करें मैं WPF में एक कस्टम नियंत्रण कर रहा हूँ। मैं अभी भी एक टेम्पलेट बाइंडिंग (कस्टम नियंत्रण में बहुत उपयोग किया जाता है) के इन-एंड-आउट सीख रहा हूं।टेम्पलेट बाइंडिंग
एक सोचता है कि मुझे लगता है कि मैं एक MulitBinding के अंदर टेम्पलेट बाइंडिंग का उपयोग नहीं कर सकता।
जब मैं इस प्रयास करें:
The value "System.Windows.TemplateBindingExpression" is not of type "System.Windows.Data.BindingBase" and cannot be used in this generic collection.
Parameter name: value
मैं कुछ याद आ रही हूँ:
<ComboBox.ItemsSource>
<MultiBinding Converter="{StaticResource MyMultiConverter}">
<Binding ElementName="PART_AComboBox" Path="SelectedItem"/>
<TemplateBinding Property="MyListOne"/>
<TemplateBinding Property="MyListTwo"/>
</MultiBinding>
</ComboBox.ItemsSource>
मैं इस त्रुटि मिलती है? क्या यह काम करने का कोई तरीका है?
इस तरीके को मैं जा रहा है, लेकिन यह एक हैक की तरह है:
<ListBox x:Name="ListOne"
ItemsSource="{TemplateBinding MyListOne}"
Visibility="Collapsed" />
<ListBox x:Name="ListTwo"
ItemsSource="{TemplateBinding MyListTwo}"
Visibility="Collapsed" />
<ComboBox.ItemsSource>
<MultiBinding Converter="{StaticResource DictionaryFilteredToKeysConverter}">
<Binding ElementName="PART_TextTemplateAreasHost" Path="SelectedItem"/>
<Binding ElementName="ListOne" Path="ItemsSource"/>
<Binding ElementName="ListTwo" Path="ItemsSource"/>
</MultiBinding>
</ComboBox.ItemsSource>
मैं निर्भरता संपत्ति को listboxes बाँध और फिर मेरी mulitbinding में मैं के ItemsSource के लिए एक तत्व बाँध कर सूची बक्से
जैसा कि मैंने उपरोक्त कहा है, यह एक हैक और जैसा लगता है, मैं जानना चाहता हूं कि टेम्पलेट बाइंडिंग के साथ मल्टी बाइंडिंग करने के लिए कोई सही तरीका है या नहीं।
बिल्कुल सही! महान जवाब के लिए धन्यवाद! – Vaccano