コード例 #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);
        }
コード例 #2
0
ファイル: PUComboBox.cs プロジェクト: zhj149/PanuonUI
        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);
        }