Reputation: 6226
I have two listboxes that are very close together, one on top and one on bottom. Is it possible to have one of the listbox items on the top listbox overlap the listbox below?
Upvotes: 1
Views: 1142
Reputation: 96722
You mean, like this? If so, a negative top margin is the answer:
<DockPanel>
<DockPanel.Resources>
<Style x:Key="{x:Type Button}"
TargetType="Button">
<Setter Property="Width"
Value="50" />
</Style>
</DockPanel.Resources>
<ListBox DockPanel.Dock="Top">
<ListBoxItem>
<Button>Foo</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Bar</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Baz</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Bat</Button>
</ListBoxItem>
</ListBox>
<ListBox DockPanel.Dock="Top" Margin="0, -10, 0, 0">
<ListBoxItem>
<Button>Foo</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Bar</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Baz</Button>
</ListBoxItem>
<ListBoxItem>
<Button>Bat</Button>
</ListBoxItem>
</ListBox>
<TextBlock />
</DockPanel>
Upvotes: 1