コード例 #1
0
ファイル: PropertyEditor.cs プロジェクト: 5l1v3r1/Maze-1
        protected virtual void ResolveValueBinding(PropertyEditorContext <TEditor> context)
        {
            var binding = new Binding(nameof(IProperty.Value))
            {
                Source = context.PropertyItem,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode      = context.PropertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay,
                Converter = CreateValueConverter(context)
            };

            BindingOperations.SetBinding(context.Editor, context.ValueProperty, binding);
        }
コード例 #2
0
ファイル: PropertyEditor.cs プロジェクト: 5l1v3r1/Maze-1
        public FrameworkElement CreateEditor(PropertyItem propertyItem)
        {
            if (!IsSupported(propertyItem, propertyItem.Property.PropertyType))
            {
                return(null);
            }

            var context = new PropertyEditorContext <TEditor>(propertyItem.Property, propertyItem);

            context.Editor        = CreateEditor(context);
            context.ValueProperty = GetDependencyProperty();

            InitializeControl(context);
            ResolveValueBinding(context);

            return(context.Editor);
        }
コード例 #3
0
ファイル: PropertyEditor.cs プロジェクト: 5l1v3r1/Maze-1
 protected virtual void InitializeControl(PropertyEditorContext <TEditor> context)
 {
 }
コード例 #4
0
ファイル: PropertyEditor.cs プロジェクト: 5l1v3r1/Maze-1
 protected virtual IValueConverter CreateValueConverter(PropertyEditorContext <TEditor> context)
 {
     return(new NullAsDefaultConverter(context.Property.PropertyType));
 }
コード例 #5
0
ファイル: PropertyEditor.cs プロジェクト: 5l1v3r1/Maze-1
 protected virtual TEditor CreateEditor(PropertyEditorContext <TEditor> context)
 {
     return(new TEditor());
 }