Reputation: 5994
I have a listbox that is created with this code:
<ListBox x:Name="listBox" ItemsSource="{Binding}" ItemContainerStyle="{StaticResource Office2010SilverListBoxItemStyle}"
SelectionChanged="listBox_SelectionChanged">
</ListBox>
Now I want to apply a contextmenue to each item. How can I use my current style but with a context menue. Can i do something like a derivation from that style? Would be really great if you would know something to solve that problem... :)
Upvotes: 0
Views: 178
Reputation: 4776
To derive from a style you can use the basedon property, for instance:
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource ButtonStyle1}">
<Setter Property="Foreground" Value="Green"/>
</Style>
Upvotes: 0
Reputation: 15237
If you wrote the Office2010SilverListBoxItemStyle
style yourself, you should be able to add something like adding another setter to it:
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
...
</ContextMenu>
</Setter.Value>
</Setter>
Upvotes: 1