本文整理汇总了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;未经允许,请勿转载。 |
请发表评论