-
- ExtZGholson
- Posts: 22
- Joined:
Context Menu Visual is null
Hello,
I am currently looking to add a context menu to assist in debugging. When I follow the context menu example provided the MenuItems do not seem to format correctly and a Noesis Error is throw; `Visual is null`. Am I missing something?
I am currently looking to add a context menu to assist in debugging. When I follow the context menu example provided the MenuItems do not seem to format correctly and a Noesis Error is throw; `Visual is null`. Am I missing something?
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Border Width="360" Background="Gray" Padding="20">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="View">
<MenuItem Header="Large icons"/>
<MenuItem Header="Small icons"/>
<MenuItem Header="List"/>
<MenuItem Header="Details"/>
</MenuItem>
<MenuItem Header="Sort by">
<MenuItem Header="Name"/>
<MenuItem Header="Date"/>
<MenuItem Header="Type"/>
</MenuItem>
<MenuItem Header="Refresh"/>
<Separator/>
<MenuItem Header="Pin to TaskBar" IsCheckable="True"/>
</ContextMenu>
</Border.ContextMenu>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" Text="Right click to open Context Menu"/>
</Border>
</Grid>
</Grid>-
- ExtZGholson
- Posts: 22
- Joined:
Re: Context Menu Visual is null
I did some digging and found my answer! We need to make a visual template for the context menu.
-
-
sfernandez
Site Admin
- Posts: 3364
- Joined:
Re: Context Menu Visual is null
Every control needs a template to render, so every time you see some control showing with a magenta background it would indicate it is using our internal debug templates.
We recommend to start by including our Theme in your application resources as base, then create the styles/template for the controls you are going to use.
We recommend to start by including our Theme in your application resources as base, then create the styles/template for the controls you are going to use.
Who is online
Users browsing this forum: Bing [Bot] and 3 guests