【问题标题】:Windows Phone DropdownWindows Phone 下拉菜单
【发布时间】:2011-04-13 19:35:17
【问题描述】:

我发现 windows phone 工具箱中没有提供下拉菜单/组合框。我可以看到必须有一种创建方法,因为在手机的设置中,选择主题本质上是一个下拉菜单。

有谁知道我可以从哪里获得如何创建示例代码?我看过一些示例,但 xaml 似乎真的很长而且很复杂。创建这个控件真的有那么难吗?

【问题讨论】:

标签: windows-phone-7


【解决方案1】:

你可以使用Silverlight for Windows Phone Toolkit(你真的应该使用这个)。 ListPicker 控件会做你想做的事。

这是一个关于如何使用它的深入教程:http://www.windowsphonegeek.com/articles/listpicker-for-wp7-in-depth

这里是它的描述(来自here):

列表选择器

组合框在 WP7 中并不酷 开发。因此,请改用 ListPicker。 两种格式可用。首先 扩展到位,为您提供选择。 对于短名单很有用。第二 带你到另一个页面 完整的列表框可供选择 返回呼叫屏幕。你可以 当你改变时看到这个在 WP7 上使用 设置/铃声和声音。

【讨论】:

    【解决方案2】:

    选择一个主题实际上是创建一个新页面,在选择一种颜色时,它会导航回具有该值的上一页。

    我就是这样做的:

    private void modelListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        //if SelectedIndex == -1, do nothing
        if(modelListBox.SelectedIndex == -1)
            return;
    
        //navigate to the MainPage
        NavigationService.Navigate(new Uri
            (String.Format("/views/MainPage.xaml?MakeIndex={0}&ModelIndex={1}", m_nCameraDataIndex, modelListBox.SelectedIndex),
            UriKind.Relative));
    
        //reset SelectedIndex
        modelListBox.SelectedIndex = -1;
    } //end method modelListBox_SelectionChanged
    

    对于一个 ddlist,我发现了这个:

    http://www.simego.com/Blog/2008/05/combobox-dropdo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 2018-01-27
      • 1970-01-01
      相关资源
      最近更新 更多