Esempio n. 1
0
        private static void ItemsSourcePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker            customListPicker = (CustomListPicker)sender;
            List <CustomListPickerItem> source           = (List <CustomListPickerItem>)e.NewValue;

            if (source != null)
            {
                customListPicker.SelectedItem = source.Any <CustomListPickerItem>() ? source.First <CustomListPickerItem>() : (CustomListPickerItem)null;
            }
            customListPicker.SelectedItem = (CustomListPickerItem)null;
        }
Esempio n. 2
0
        private static void ItemsSourcePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker customListPicker = (CustomListPicker)sender;
            // ISSUE: explicit reference operation
            List <CustomListPickerItem> newValue = (List <CustomListPickerItem>)e.NewValue;

            if (newValue != null)
            {
                customListPicker.SelectedItem = Enumerable.Any <CustomListPickerItem>(newValue) ? Enumerable.First <CustomListPickerItem>(newValue) : null;
            }
            customListPicker.SelectedItem = null;
        }
Esempio n. 3
0
        private static void PlaceholderPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker customListPicker = (CustomListPicker)sender;
            string           str = (string)e.NewValue;

            if (customListPicker.SelectedItem != null && !customListPicker.SelectedItem.IsUnknown)
            {
                return;
            }
            customListPicker.SelectedItemTitleBlock.Text       = str;
            customListPicker.SelectedItemTitleBlock.Foreground = (Brush)Application.Current.Resources["PhoneCommunityManagementSectionIconBrush"];
        }
Esempio n. 4
0
        private static void SelectedItemPlaceholderPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker     customListPicker1 = (CustomListPicker)sender;
            string               str = (string)e.NewValue;
            CustomListPicker     customListPicker2    = customListPicker1;
            CustomListPickerItem customListPickerItem = new CustomListPickerItem();

            customListPickerItem.Name = str;
            int num = customListPicker1.Placeholder == str ? 1 : (str == null ? 1 : 0);

            customListPickerItem.IsUnknown = num != 0;
            customListPicker2.SelectedItem = customListPickerItem;
        }
Esempio n. 5
0
        private static void SelectedItemPlaceholderPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker customListPicker1 = (CustomListPicker)sender;
            // ISSUE: explicit reference operation
            string               newValue             = (string)e.NewValue;
            CustomListPicker     customListPicker2    = customListPicker1;
            CustomListPickerItem customListPickerItem = new CustomListPickerItem();

            customListPickerItem.Name = newValue;
            int num = customListPicker1.Placeholder == newValue ? 1 : (newValue == null ? 1 : 0);

            customListPickerItem.IsUnknown = num != 0;
            customListPicker2.SelectedItem = customListPickerItem;
        }
Esempio n. 6
0
 public SelectionPageViewModel(CustomListPicker parentPicker)
 {
     this._parentPicker  = parentPicker;
     this.SelectionTitle = parentPicker.SelectionTitle;
     this.Items          = new ObservableCollection <SelectionPageItem>((IEnumerable <SelectionPageItem>)Enumerable.Select <CustomListPickerItem, SelectionPageItem>(parentPicker.ItemsSource, (Func <CustomListPickerItem, SelectionPageItem>)(i =>
     {
         string str = i != parentPicker.SelectedItem ? "PhoneContrastTitleBrush" : "PhoneBlue300Brush";
         return(new SelectionPageItem()
         {
             Title = i.Name,
             Source = i,
             Foreground = (SolidColorBrush)Application.Current.Resources[str]
         });
     })));
 }
Esempio n. 7
0
        private static void SelectedItemPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker     customListPicker     = (CustomListPicker)sender;
            CustomListPickerItem customListPickerItem = (CustomListPickerItem)e.NewValue;

            if (customListPickerItem != null && !customListPickerItem.IsUnknown)
            {
                customListPicker.SelectedItemTitleBlock.Text       = customListPickerItem.Name;
                customListPicker.SelectedItemTitleBlock.Foreground = (Brush)Application.Current.Resources["PhoneContrastTitleBrush"];
            }
            else
            {
                customListPicker.SelectedItemTitleBlock.Text       = customListPicker.Placeholder;
                customListPicker.SelectedItemTitleBlock.Foreground = (Brush)Application.Current.Resources["PhoneCommunityManagementSectionIconBrush"];
            }
        }