none
win8.1 关于ComboBox弹出问题 如何点击后列表始终向上弹出?而不是根据选项 RRS feed

答案

  • 我这两天也在看这个,感觉似乎是写死的,貌似还是得自己使用一个ListBox和TextBox来重写吧。之前我有写过类似这样的代码,你可以参考一下:https://onedrive.live.com/?cid=d22c3bcb62964267&id=D22C3BCB62964267%21209

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 lxd_DD 2014年7月28日 8:47
    2014年7月28日 7:58
    版主
  • 你好,做了个Sample上传了一下:http://code.msdn.microsoft.com/Traditional-Style-ComboBox-ed03ea63


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 lxd_DD 2015年2月5日 7:37
    2014年8月18日 5:28
    版主

全部回复

  • 你好 lxdhuainan,

    建议自己重写一个UserControl,这样比较容易指定位置,也可以通过Flyout.Placement来强制设定弹出的位置。个人认为这个是比较容易的办法(其实因为是下面这个办法我没有实现)。

    如果单纯的想通过ComboBox中PopupBoder来重新定义位置的话,我没有实现这个改动。

    我尝试过对PopupBoder的Visual State做修改,但是没有效果,如果你有兴趣的话可以继续研究一下。我发现每次ComboBox下拉的时候,OffsetFromCenter的值都会变化,我尝试给他设定固定值,但是发现没有用,我个人觉得关键就在这里:

      <SplitOpenThemeAnimation ClosedTargetName="ContentPresenter" 
             ContentTranslationOffset="0" 
             ContentTargetName="ScrollViewer" 
             ClosedLength="{Binding TemplateSettings.DropDownClosedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
             OffsetFromCenter="{Binding TemplateSettings.DropDownOffset, Converter={StaticResource Converter1}, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
             OpenedTargetName="PopupBorder" 
             OpenedLength="{Binding TemplateSettings.DropDownOpenedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}"
      />

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年7月24日 8:25
    版主
  • 谢谢James的回答,我按照你的方法再研究研究!!!
    2014年7月24日 9:53
  • 我这两天也在看这个,感觉似乎是写死的,貌似还是得自己使用一个ListBox和TextBox来重写吧。之前我有写过类似这样的代码,你可以参考一下:https://onedrive.live.com/?cid=d22c3bcb62964267&id=D22C3BCB62964267%21209

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 lxd_DD 2014年7月28日 8:47
    2014年7月28日 7:58
    版主
  • 你好,做了个Sample上传了一下:http://code.msdn.microsoft.com/Traditional-Style-ComboBox-ed03ea63


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 lxd_DD 2015年2月5日 7:37
    2014年8月18日 5:28
    版主