Compare ObservableCollection with Toggle Button listBox?
i have listbox taht fill with list of toggle button in after run the
project, if i have observablecollection and i want to compare this
ObservableCollection with items in list box where if the item in
ObservableCollection exist in listbox i want to make this item (toggle
button) checked,
i have tryed to do that but i cant access to toggle button in code behind,
becouse the list of toggle buttons show after run the project.
here's my listbox code :
<ListBox x:Name="lbname" ItemsSource="{Binding source}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ToggleButton x:Name="btnitem" Content="{Binding Name}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>
and my observableCollection :
IQueryable<items> query = _context.items;
ocitems = new ObservableCollection<items>(query);
In short : How can i compare ObservableCollection items with listbox
(Buttons) and if item exist in listbox make the Toggle button that
represent the item is checked?
hope this clear.
No comments:
Post a Comment