本文整理汇总了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;
}
示例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;
}