开发者

Overlap ListBox Items

开发者_开发技巧

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?


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜