silverlight - 指定 Silverlight 组合框弹出方向(下拉)

标签 silverlight combobox direction

是否可以使 silverlight 组合框“下拉”,即在组合框上方显示弹出窗口,而不是默认显示在下方?

最佳答案

第一步是定义您自己的组合框模板,其中包含弹出窗口的定义。例如,使用 Blend 编辑副本。

但是,将该 Popup 放置在上方并不是一件容易的任务,因为 Silverlight Popups 没有像 WPF 中那样允许在上方显示的 PlacementPlacementTarget 属性。

幸运的是Kent Boogaart wrote an Attached Behavior添加了此功能,其使用方式如下:

<Popup b:PopupPlacement.PlacementTarget="{Binding ElementName=ContentPresenterBorder}">
    <b:Popup.PreferredOrientations>
        <b:PopupOrientationCollection>
            <b:PopupOrientation Placement="Top" HorizontalAlignment="Center"/>
            <b:PopupOrientation Placement="Bottom" HorizontalAlignment="Center"/>
            <b:PopupOrientation Placement="Right" VerticalAlignment="Center"/>
            <b:PopupOrientation Placement="Right" VerticalAlignment="TopCenter"/>
        </b:PopupOrientationCollection>
    </b:Popup.PreferredOrientations>

    <!--Popup content with the ItemPresenter-->
</Popup>

其中 ContentPresenterBorder 是保存 ComboBox 的 ToggleButton 的容器的名称。

关于silverlight - 指定 Silverlight 组合框弹出方向(下拉),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5153582/

相关文章:

silverlight - Silverlight 的 DataTemplate 中缺少 FindName 方法是否有解决方法?

asp.net - asp.net、javascript 和 silverlight 的共享本地化?

c# - ComboBox 在键入时更改文本颜色的事件

Xamarin.Forms UWP - 如何隐藏或更改选择器/组合框下拉箭头的颜色

javascript - 动态定义页面方向 - Angular 5

c# - Silverlight:命名空间中不存在 Web

silverlight - 如何找出我应该从套接字读取多少?

python - Python-GTK3 中的 set_text 在哪里设置输入文本?

actionscript-3 - As3 如何翻转影片剪辑以面向运动方向?

ms-word - 如何更改 Apache word poi (XWPF) 中的表方向?