Example #1
0
        private PUComboBoxItem GenerateComboBoxItem(PUComboBoxItemModel model)
        {
            var comboBoxItem = new PUComboBoxItem()
            {
                Uid       = model.Uid,
                Content   = model.Header,
                Value     = model.Value,
                CanDelete = model.CanDelete,
            };

            model.PropertyChanged += delegate
            {
                comboBoxItem.Content   = model.Header;
                comboBoxItem.Value     = model.Value;
                comboBoxItem.CanDelete = model.CanDelete;
            };

            return(comboBoxItem);
        }
Example #2
0
        private PUComboBoxItem GenerateComboBoxItem(PUComboBoxItemModel model)
        {
            var comboBoxItem = new PUComboBoxItem()
            {
                Content = model.Header,
                Value   = model.Value,
                DeleteButtonVisibility = model.CanDelete ? Visibility.Visible : Visibility.Hidden,
            };

            if (Items.Count == 0)
            {
                comboBoxItem.IsSelected = true;
            }

            model.PropertyChanged += delegate
            {
                comboBoxItem.Content = model.Header;
                comboBoxItem.Value   = model.Value;
                comboBoxItem.DeleteButtonVisibility = model.CanDelete ? Visibility.Visible : Visibility.Hidden;
            };

            return(comboBoxItem);
        }