2015-02-11 26 views
0

我想在Windows应用程序中获得ComoboBox以向上打开而不是向下打开。我已阅读关于在WPF中做这件事,但显然语法有点不同。我试着修改ComboBoxControlTemplate,但我不确定我应该修改哪些属性。Windows应用程序组合框向上打开

有没有简单的方法来做到这一点Windows App

编辑:当我尝试申请弗洛里安的修复,我得到下面的生成错误:

Error 1 'Windows.UI.Xaml.Controls.ControlTemplate' does not contain a definition for 'FindName' and no extension method 'FindName' 
accepting a first argument of type 'Windows.UI.Xaml.Controls.ControlTemplate' could be found (are you missing a using directive or an assembly reference?) 

回答

0

调用此方法时,组合装:

private void myCombo_Loaded(object sender, System.Windows.RoutedEventArgs e) 
    { 
     ControlTemplate ct = this.myCombo.Template; 
     Popup pop = ct.FindName("PART_Popup", this.myCombo) as Popup; 
     pop.Placement = PlacementMode.Top; 
    } 
+0

我做了尝试,和我得到编译错误在线ct.FindName它说它不能解决符号“FindName”在ct – user2357446 2015-02-11 15:48:10

+0

听起来像一个问题与Resharper。你在使用它吗? – 2015-02-11 15:57:19

+0

我是。但是我认为Windows应用程序API没有像普通WPF那样的可用方法,并且FindName是缺少的方法之一?编辑:是的,当我尝试使用FindName构建时遇到编译错误。详情请看我的主要帖子。 – user2357446 2015-02-11 16:00:12

相关问题