How to use styles in xamls for items created in code
Posted: 01 Mar 2020, 16:33
I need some button rows depending on categories selected. So i have an ObservableCollection<Button> that gets updated and some xaml code
That works and I can see my buttons change depending on the collection. Now the button class has all kinds of setters for its attributes which all require c++ objects but how can I tell the buttons to use a style defined in a ResourceDictionary?
Code: Select all
<ItemsControl ItemsSource="{Binding BuildButtons}" Grid.Row="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>