WPF: Popup Overlay window, item on top
How can you highlight an element in XAML over other elements?
In XAML, the elements are drawn from top to bottom. This means that all the display elements, which are located further down, overlay the other UI elements.
This makes the previous display elements no longer visible.
Grid with Rows and Columns
If I am in a grid with a row and place a UIElement there, then this is only drawn within this row. All the overlying areas of an element such as rectangle, panel, textbox are simply not displayed and disappear in the following row. It does not matter which ZIndex as Render levels position you assign to a framework element.
4 ways to overlay.
Some elements can nevertheless move outside the other elements.
1) Menu item
2) Combobox element
3) Popup element
With the menu, control box and popup control you can directly assign or read the values to an element.
With a window you have to transfer values to and from Windows.
Subject: WPF, UWP, ZIndex, Popup, Window, Combobox, Menu
Not available via Panel.ZIndex
The following illustration shows a combo box as a drop-down list within a grid row.
So you can embed any other UIElement, Framework element in a ListItem within a combo box element and thus display it as a superposition
However, one must then still switch the base element transparent.
Combobox in XAML, Wpf
Popup in XAML, WPF
<ComboBox x:Name="menuFolder" HorizontalAlignment="Stretch" Visibility="Visible"
<ComboBoxItem Content="Item #1" />
<ComboBoxItem Content="Item #2" />
<ComboBoxItem Content="Item #3" />
Display as popup element
Other elements are not recorded externally, even if the Panel.ZIndex is applied.
In this case, the Grid is used as a UserControl within a Grid.Row in the MainWindows.
The rectangle or other UIE elements are simply cut off at the row height.
<Popup Name="popupFolders" IsOpen="False" MouseLeave="StackPanel_MouseLeave">
<ListBoxItem>Listbox Item 1</ListBoxItem>
<ListBoxItem>Listbox Item 2</ListBoxItem>
<ListBoxItem>Listbox Item 3</ListBoxItem>
<ListBoxItem>Listbox Item 4</ListBoxItem>
<ListBoxItem>Listbox Item 10</ListBoxItem>
<ListBoxItem>Listbox Item 11</ListBoxItem>
<Grid MouseEnter="StackPanel_MouseEnter" >
<StackPanel x:Name="pnlPath" Orientation="Horizontal" >
<Label x:Name="lblPath" Content="Path" VerticalAlignment="Top" />
<Image x:Name="imgFolder" Source="/wpf_Browse_Folders;component/_images/imgExpand_Right.png" VerticalAlignment="Top" />