• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PropertyItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PropertyItem的典型用法代码示例。如果您正苦于以下问题:C# PropertyItem类的具体用法?C# PropertyItem怎么用?C# PropertyItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyItem类属于命名空间,在下文中一共展示了PropertyItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateComboBox

 protected virtual FrameworkElement CreateComboBox(PropertyItem pi, PropertyControlFactoryOptions options)
 {
     var cbox = new ComboBox() { IsEditable = true };
     cbox.SetBinding(Selector.SelectedItemProperty, new Binding(pi.Descriptor.Name + ".Text"));
     cbox.SetBinding(ItemsControl.ItemsSourceProperty, new Binding(pi.Descriptor.Name + ".Values"));
     return cbox;
 }
开发者ID:shuxingliu,项目名称:SambaPOS-3,代码行数:7,代码来源:PropertyControlFactory.cs


示例2: DateTimeEditor

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue = property.Value;
              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              contentPanel = new StackPanel();
              this.Content = contentPanel;

              datePicker = new DatePicker
              {
            Visibility = Visibility.Visible,
            Margin = new Thickness(0),
            VerticalAlignment = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Stretch
              };

              datePicker.CalendarOpened += dtp_CalendarOpened;
              datePicker.CalendarClosed += dtp_CalendarClosed;
              datePicker.LostFocus += dtp_LostFocus;
              contentPanel.Children.Add(datePicker);
              datePicker.Focus();

              this.ShowTextBox();
        }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:31,代码来源:DateTimeEditor.cs


示例3: PropertyItemValue

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyItemValue"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        public PropertyItemValue(PropertyItem property)
        {
            if (property == null) throw new ArgumentNullException("property");
              this._property = property;

              _hasSubProperties = property.Converter.GetPropertiesSupported();

              if (_hasSubProperties)
              {
            object value = property.GetValue();

            PropertyDescriptorCollection descriptors = property.Converter.GetProperties(value);
            foreach (PropertyDescriptor d in descriptors)
            {
              _subProperties.Add(new PropertyItem(property.Owner, value, d));
              // TODO: Move to PropertyData as a public property
              NotifyParentPropertyAttribute notifyParent = d.Attributes[KnownTypes.Attributes.NotifyParentPropertyAttribute] as NotifyParentPropertyAttribute;
              if (notifyParent != null && notifyParent.NotifyParent)
              {
            d.AddValueChanged(value, NotifySubPropertyChanged);
              }
            }
              }

              this._property.PropertyChanged += new PropertyChangedEventHandler(ParentPropertyChanged);
        }
开发者ID:GonzRu,项目名称:WPG,代码行数:30,代码来源:PropertyItemValue.cs


示例4: PropertyItemValue

		/// <summary>
		///     Initializes a new instance of the <see cref="PropertyItemValue" /> class.
		/// </summary>
		/// <param name="property">The property.</param>
		public PropertyItemValue(PropertyItem property)
		{
			if (property == null) throw new ArgumentNullException("property");
			_property = property;

			_hasSubProperties = property.Converter.GetPropertiesSupported();

			if (_hasSubProperties)
			{
				var value = property.GetValue();

				var descriptors = property.Converter.GetProperties(value);
				foreach (PropertyDescriptor d in descriptors)
				{
					_subProperties.Add(new PropertyItem(property.Owner, value, d));
					// TODO: Move to PropertyData as a public property
					var notifyParent =
						d.Attributes[KnownTypes.Attributes.NotifyParentPropertyAttribute] as NotifyParentPropertyAttribute;
					if (notifyParent != null && notifyParent.NotifyParent)
					{
						d.AddValueChanged(value, NotifySubPropertyChanged);
					}
				}
			}

			if (property.IsCollection)
			{
				LoadCollectionValues();
			}

			_property.PropertyChanged += ParentPropertyChanged;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:36,代码来源:PropertyItemValue.cs


示例5: StringEditor

        public StringEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            if (property.PropertyType == typeof(Char))
              {
            if ((char)property.Value == '\0')
              property.Value = "";
              }

              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              textBox = new TextBox
              {
            Height = 20,
            Foreground = Property.CanWrite ? Brushes.Black : Brushes.Gray,
            BorderThickness = new Thickness(0),
            Margin = new Thickness(0),
            IsReadOnly = !Property.CanWrite
              };

              if (null != property.Value)
            textBox.Text = property.Value.ToString();

              if (Property.CanWrite)
            textBox.TextChanged += Control_TextChanged;

              Content = textBox;
              GotFocus += StringValueEditor_GotFocus;
        }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:30,代码来源:StringEditor.cs


示例6: PersonAdapter

        public PersonAdapter(PersonViewModel viewModel)
        {
            items = new List<Item> ();

            foreach (var pg in viewModel.PropertyGroups) {
                items.Add (new MainHeaderItem (pg.Title));
                foreach (var p in pg.Properties) {

                    PropertyItem item;

                    switch (p.Type) {
                    case PersonViewModel.PropertyType.Phone:
                        item = new PhonePropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Email:
                        item = new EmailPropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Url:
                        item = new UrlPropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Twitter:
                        item = new TwitterPropertyItem (p);
                        break;
                    default:
                        item = new PropertyItem (p);
                        break;
                    }

                    items.Add (item);
                }
            }
        }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:32,代码来源:PersonAdapter.cs


示例7: ButtonEditor

 public ButtonEditor(PropertyLabel label, PropertyItem property)
     : base(property)
 {
     var button = new Button { Content = "..." };
       button.Click += (sender, e) => MessageBox.Show("Custom dialog comes here...");
       this.Content = button;
 }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:7,代码来源:ButtonEditor.cs


示例8: StringValueEditor

        public StringValueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            if (property.PropertyType == typeof(Char))
            {
                if ((char)property.Value == '\0')
                    property.Value = "";
            }

            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            txt = new TextBox();
            txt.Height = 20;
            if (null != property.Value)
                txt.Text = property.Value.ToString();
            //txt.IsReadOnly = !this.Property.CanWrite;
            txt.Foreground = this.Property.CanWrite ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(Colors.Gray);
            txt.BorderThickness = new Thickness(0);
            txt.Margin = new Thickness(0);

            if (this.Property.CanWrite)
                txt.TextChanged += new TextChangedEventHandler(Control_TextChanged);

            this.Content = txt;
            this.GotFocus += new RoutedEventHandler(StringValueEditor_GotFocus);
        }
开发者ID:Jitlee,项目名称:MonitorProject,代码行数:27,代码来源:StringValueEditor.cs


示例9: PersonAdapter

        public PersonAdapter (PersonViewModel viewModel)
        {
            items = new List<Item> ();

            foreach (var pg in viewModel.PropertyGroups) {
                items.Add (new MainHeaderItem (pg.Title));
                foreach (var p in pg.Properties) {

                    PropertyItem item;

                    if (p.Type == PersonViewModel.PropertyType.Phone) {
                        item = new PhonePropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Email) {
                        item = new EmailPropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Url) {
                        item = new UrlPropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Twitter) {
                        item = new TwitterPropertyItem (p);
                    } else {
                        item = new PropertyItem (p);
                    }

                    items.Add (item);
                }
            }
        }
开发者ID:EminosoftCorp,项目名称:prebuilt-apps,代码行数:26,代码来源:PersonAdapter.cs


示例10: ComboBoxEditorBase

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public ComboBoxEditorBase(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue = property.Value;
              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              cbo = new ComboBox
              {
            Visibility = Visibility.Collapsed,
            Margin = new Thickness(0),
            VerticalAlignment = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Stretch
              };

              cbo.DropDownOpened += cbo_DropDownOpened;
              cbo.LostFocus += cbo_LostFocus;

              this.InitializeCombo();

              pnl = new StackPanel();
              pnl.Children.Add(cbo);

              this.ShowTextBox();

              this.Content = pnl;
        }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:32,代码来源:ComboBoxEditorBase.cs


示例11: UserDefinedPropertyEditorDlg

        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="project">The project file reference</param>
        public UserDefinedPropertyEditorDlg(SandcastleProject project)
        {
            PropertyItem propItem;

            InitializeComponent();

            this.Project = project;
            this.UserDefinedProperties = new Collection<PropertyItem>();

            lbProperties.Sorted = true;

            try
            {
                foreach(BuildProperty prop in this.Project.GetUserDefinedProperties())
                {
                    propItem = new PropertyItem(this, prop);
                    this.UserDefinedProperties.Add(propItem);
                    lbProperties.Items.Add(propItem);
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Unable to load user-defined properties.  " +
                    "Error " + ex.Message, Constants.AppName,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            lbProperties.Sorted = false;

            if(lbProperties.Items.Count == 0)
                pgProps.Enabled = false;
            else
                lbProperties.SelectedIndex = 0;
        }
开发者ID:codemonster234,项目名称:scbuilder,代码行数:39,代码来源:UserDefinedPropertyEditorDlg.cs


示例12: PropertyValueChangedEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyValueChangedEventArgs"/> class.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="property">The property.</param>
 /// <param name="oldValue">The old value.</param>
 public PropertyValueChangedEventArgs(RoutedEvent routedEvent, PropertyItem property, object oldValue)
     : base(routedEvent, property)
 {
     Property = property;
     NewValue = property.PropertyValue;
     OldValue = oldValue;
 }
开发者ID:denkhaus,项目名称:WPG,代码行数:13,代码来源:PropertyValueChangedEventArgs.cs


示例13: ImageVaueEditor

        public ImageVaueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            _attribute = property.GetAttribute<ImageAttribute>();

            if(null == _attribute)
            {
                _attribute = new ImageAttribute();
                _attribute.OnlyImage = false;
            }
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.ColumnDefinitions.Add(new ColumnDefinition());
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.Children.Add(_image);
            _grid.Children.Add(_text);
            _grid.Children.Add(_removeButton);
            _grid.Children.Add(_broswerButton);
            _image.SetValue(Grid.ColumnProperty, 0);
            _text.SetValue(Grid.ColumnProperty, 1);
            _removeButton.SetValue(Grid.ColumnProperty, 2);
            _broswerButton.SetValue(Grid.ColumnProperty, 3);
            this.Content = _grid;
            _broswerButton.Click += BroswerButton_Click;
            _removeButton.Click += RemoveButton_Click;
            UpdateLabel(property.Value);
            _text.GotFocus += Text_GotFocus;
            _text.Background = null;
            _text.BorderBrush = null;
            _text.BorderThickness = new Thickness();
        }
开发者ID:Jitlee,项目名称:WPFMonitor,代码行数:34,代码来源:ImageVaueEditor.cs


示例14: CreateControl

 public override FrameworkElement CreateControl(PropertyItem pi, PropertyControlFactoryOptions options)
 {
     if (pi.Is(typeof(IValueWithSource)))
     {
         return CreateComboBox(pi, options);
     }
     return base.CreateControl(pi, options);
 }
开发者ID:basio,项目名称:SambaPOS-3,代码行数:8,代码来源:PropertyControlFactory.cs


示例15: ShouldApplyPropertyReadonlyState

        public void ShouldApplyPropertyReadonlyState()
        {
            PropertyItem property = new PropertyItem(
            new PropertyGrid(),
            new BusinessObject(),
            TypeDescriptor.GetProperties(typeof(BusinessObject))["ReadOnlyProperty"]);

              Assert.IsTrue(property.IsReadOnly);
        }
开发者ID:GonzRu,项目名称:WPG,代码行数:9,代码来源:PropertyItemTest.cs


示例16: ExtendedPropertyEditorTab

        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedPropertyEditorTab"/> class.
        /// </summary>
        /// <param name="property">The property to display extended editor for.</param>
        public ExtendedPropertyEditorTab(PropertyItem property)
            : this()
        {
            if (property == null) throw new ArgumentNullException("property");

              Property = property;
              Header = property.Name;
              Content = CreateContent(property);
        }
开发者ID:GonzRu,项目名称:WPG,代码行数:13,代码来源:ExtendedPropertyEditorTab.cs


示例17: SelectValueEditor

    //private SelectValueEditorAttribute _attrs = null;

    /// <summary>
    /// Данный конструктор используется в динамических PropertyGrid, на событии OnCustomEditor
    /// </summary>
    /// <param name="label"></param>
    /// <param name="property"></param>
    /// <param name="attrs"></param>
    public SelectValueEditor(PropertyGridLabel label, PropertyItem property, SelectValueEditorAttribute attrs)
      : base(label, property) {
      var v_attrs = attrs ?? this.Property.GetAttribute<SelectValueEditorAttribute>();
      this.SelectorPlugin = v_attrs.SelectorPluginName;
      this.DisplayField = v_attrs.DisplayFieldName;
      this.ValueField = v_attrs.ValueFieldName;
      this.IsMultiselector = v_attrs.isMultiselector;
      
    }
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:17,代码来源:SelectValueEditor1.cs


示例18: EditorBase

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">The associated label for this Editor control</param>
 /// <param name="property">The associated PropertyItem for this control</param>
 public EditorBase(PropertyItem property)
 {
     this.Name = "textBox" + property.Name;
       this.Property = property;
       this.BorderThickness = new Thickness(0);
       this.Margin = new Thickness(0);
       this.HorizontalAlignment = HorizontalAlignment.Stretch;
       this.HorizontalContentAlignment = HorizontalAlignment.Stretch;
 }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:14,代码来源:EditorBase.cs


示例19: BrushEditor

 public BrushEditor(PropertyLabel label, PropertyItem property)
     : base(property)
 {
     currentValue = property.Value;
       property.PropertyChanged += property_PropertyChanged;
       property.ValueError += property_ValueError;
       contentPanel = new StackPanel();
       this.Content = contentPanel;
       ShowTextBox();
 }
开发者ID:DenisVuyka,项目名称:SPG,代码行数:10,代码来源:BrushEditor.cs


示例20: ShouldClearValue

        public void ShouldClearValue()
        {
            BusinessObject component = new BusinessObject() { Name = "TestName" };
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));

              Assert.AreEqual<string>("TestName", property.GetValue().ToString());

              property.ClearValue();

              Assert.AreEqual<string>("DefaultName", property.GetValue().ToString());
        }
开发者ID:GonzRu,项目名称:WPG,代码行数:11,代码来源:PropertyItemTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PropertyKey类代码示例发布时间:2022-05-24
下一篇:
C# PropertyInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap