Reputation: 11827
Is there any code or 3rd party control out there that will allow me to show a ContextMenu in WPF, where the Header text is richly formatted (ie, contains different colors, font sizes, etc).
Upvotes: 0
Views: 251
Reputation: 1091
You can customize MenuItem
as you want:
<ListBox>
<ListBoxItem Content="Item">
<ListBoxItem.ContextMenu>
<ContextMenu>
<MenuItem>
<MenuItem.Header>
<TextBlock FontFamily="Segoe UI"
FontStyle="Italic"
Foreground="Green"
Text="Some header" />
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</ListBoxItem.ContextMenu>
</ListBoxItem>
</ListBox>
Also you can create a style for TextBlock
which is inside of MenuItem.Header
.
Upvotes: 1
Reputation: 16277
WPF Popup control can serve such purposes:
<Popup Name="myPopup" IsOpen="True">
<Label Name="myLabel" Content="Some Caption"
Background="Black" Foreground="White"/>
<...other controls you like.../>
</Popup>
Upvotes: 0