There are two issues that iam facing. One is binding a collection to combobox
In code:
private ObservableCollection<string> errList;
Initially its empty and then i add items to it.
In XAML:
<comboBox ItemsSource="{Binding errList}" IsSynchronizedWithCurrentItem="True"
Isnt this enough to get it done. But no items are seen in the combobox.
Second is toggling the visibility of the combobox when items are present.
<combobox Visibility="{ Binding ElementName=Page1, Path=ItemsPresent, Converter={StaticResource booltoVis} }"
ItemsPresent is a property which returns true of errL开发者_JAVA百科ist has items more than 0. But this is not working.
Please Help
I don't think you can bind to a private field, instead after filling your collection you can do the following:
YourComboBoxName.ItemsSource = errList;
For the visibility you need to do self binding like this:
<ComboBox Visibility="{Binding Path=ItemsPresent, RelativeSource={RelativeSource Self}, Converter={StaticResource booltoVis}}"/>
精彩评论