开发者

Replacing a ComboBox's Drop-Down with a Menu

How would I replace a ComboBox's default drop-开发者_高级运维down list with a menu?


I realized that it was a lot easier to style a <Menu> to look like a <ComboBox> than it was to make a <ComboBox> show a menu.

Here's a blog post describing how to do this.


If all you are after is for the ComboBox dropdown to look like a menu then you don't need to replace anything as the ComboBox accepts arbitrary content.

E.g.

<Grid>
    <ComboBox Margin="25" MaxHeight="25">
        <TextBlock Text="Hello" />
        <TextBlock Text="Hello" />
        <TextBlock Text="Hello" />
        <TextBlock Text="Hello" />
        <Separator />
        <TextBlock Text="Hello" />
        <TextBlock Text="Hello" />
        <TextBlock Text="Hello" />
        <Separator />
        <TextBlock Text="Hello" />
    </ComboBox>
</Grid>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜