WPF ComboBox弹出窗口:底部并对齐到右边缘 [英] WPF ComboBox popup placement : Bottom and aligned to the right edge

查看:448
本文介绍了WPF ComboBox弹出窗口:底部并对齐到右边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用非标准下拉列表来创建一个 ComboBox 。基本上,我希望下拉列表低于 ComboBox ,但与 ComboBox 的右边缘对齐,而不是左边缘。

I'm trying to create a ComboBox with a non-standard dropdown alignment. Basically, I want the dropdown to be below the ComboBox, but aligned with the right edge of the ComboBox instead of the left edge.

正常的 ComboBox 看起来像使用 PlacementMode =Bottom

我想要的:

< img src =https://i.stack.imgur.com/TnzxI.pngalt =组合框向右对齐>

我试图在我的 ComboBox 的模板中玩 Popup.PlacementMode 属性,但没有可能的值似乎做我想要的有没有一个简单的方法来做,最好是在纯XAML中?

I tried to play with the Popup.PlacementMode property in the template of my ComboBox, but none of the possible values seem to do what I want. Is there a simple way to do it, preferably in pure XAML?

推荐答案

当我打开Expression Blend时,我想出了解决方案在几秒钟内:

When I opened Expression Blend, I have come up with the solution within a few seconds:

<Popup Placement="Left" VerticalOffset="{TemplateBinding ActualHeight}" 
       HorizontalOffset="{TemplateBinding ActualWidth}"

有时这个应用程序比用手写xaml更有用,但不是那么频繁。

Sometimes this application is more useful than writing xaml by hands, but not so often.

这篇关于WPF ComboBox弹出窗口:底部并对齐到右边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆