当前位置: 首页>>代码示例>>C#>>正文


C# ListPicker.SetBinding方法代码示例

本文整理汇总了C#中Microsoft.Phone.Controls.ListPicker.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# ListPicker.SetBinding方法的具体用法?C# ListPicker.SetBinding怎么用?C# ListPicker.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Phone.Controls.ListPicker的用法示例。


在下文中一共展示了ListPicker.SetBinding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateThemeColorListPicker

 private ListPicker CreateThemeColorListPicker()
 {
     ListPicker p = new ListPicker();
     p.Header = "Select document editor background color";
     p.Margin = new Thickness(12, 35, 12, 30);
     p.Items.Add(ThemeColor.dark);
     p.Items.Add(ThemeColor.light);
     p.Items.Add(ThemeColor.phone);
     p.SetBinding(ListPicker.SelectedItemProperty, GetBinding("NoteEditorThemeColor"));
     return p;
 }
开发者ID:ireynolds,项目名称:Document-Store,代码行数:11,代码来源:Settings.xaml.cs

示例2: RenderEditTaskListPointer

        private StackPanel RenderEditTaskListPointer(PropertyInfo pi, double minWidth)
        {
            StackPanel innerPanel;
            innerPanel = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };
            CheckBox listcb = new CheckBox() { DataContext = taskCopy, IsTabStop = true };
            listcb.SetBinding(CheckBox.IsCheckedProperty, new Binding("LinkedTaskListIDBool"));
            listcb.TabIndex = tabIndex++;
            ListPicker listPicker = new ListPicker()
            {
                MinWidth = minWidth,
                FullModeItemTemplate = (DataTemplate)App.Current.Resources["FullListPickerTemplate"],
                DataContext = listcb
            };
            listPicker.SetBinding(ListPicker.IsEnabledProperty, new Binding("IsChecked"));
            listPicker.ItemsSource = App.ViewModel.TaskLists;
            listPicker.DisplayMemberPath = "Name";
            Guid? taskListID = (Guid?)pi.GetValue(taskCopy, null);
            if (taskListID != null)
            {
                try
                {
                    TaskList taskListVal = App.ViewModel.TaskLists.Single(t => t.ID == (Guid)taskListID);
                    if (taskListVal != null)
                        listPicker.SelectedIndex = App.ViewModel.TaskLists.IndexOf(taskListVal);
                }
                catch (Exception)
                {
                    listPicker.SelectedIndex = 0;
                }
            }
            else
                listPicker.SelectedIndex = 0;

            // set the event handlers for the checkbox and listpicker
            listcb.Unchecked += new RoutedEventHandler(delegate { pi.SetValue(taskCopy, null, null); });
            listcb.Checked += new RoutedEventHandler(delegate { pi.SetValue(taskCopy, App.ViewModel.TaskLists[listPicker.SelectedIndex].ID, null); });
            listPicker.SelectionChanged += new SelectionChangedEventHandler(delegate
            {
                if (listcb.IsChecked == false)
                    pi.SetValue(taskCopy, null, null);
                else
                    pi.SetValue(taskCopy, App.ViewModel.TaskLists[listPicker.SelectedIndex].ID, null);
            });
            innerPanel.Children.Add(listcb);
            innerPanel.Children.Add(listPicker);
            return innerPanel;
        }
开发者ID:ogazitt,项目名称:TaskStore,代码行数:47,代码来源:TaskPage.xaml.cs


注:本文中的Microsoft.Phone.Controls.ListPicker.SetBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。