コード例 #1
0
        public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
        {
            Binding binding = new Binding("Value");

            binding.Source = propertyItem;
            binding.Mode   = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
            BindingOperations.SetBinding(this, LastNameUserControlEditor.ValueProperty, binding);
            return(this);
        }
コード例 #2
0
        public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
        {
            var binding = new Binding("Value");

            binding.Source = propertyItem;
            binding.ValidatesOnExceptions = true;
            binding.ValidatesOnDataErrors = true;
            binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
            BindingOperations.SetBinding(this._pathName, TextBox.TextProperty, binding);

            return(this);
        }
コード例 #3
0
        protected override IList <object> CreateItemsSource(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
        {
            List <object> values = new List <object>();

            values.Add("");
            foreach (var ihs in Context.GetServices <ILisService>())
            {
                var    t    = ihs.GetType();
                string name = t.FullName + ", " + t.Assembly.FullName.Substring(0, t.Assembly.FullName.IndexOf(","));
                values.Add(ihs.Type);
            }
            return(values);
        }
コード例 #4
0
        public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
        {
            TextBox textBox = new TextBox();

            textBox.Background = new SolidColorBrush(Colors.Red);

            //create the binding from the bound property item to the editor
            var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem

            _binding.Source = propertyItem;
            _binding.ValidatesOnExceptions = true;
            _binding.ValidatesOnDataErrors = true;
            _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
            BindingOperations.SetBinding(textBox, TextBox.TextProperty, _binding);
            return(textBox);
        }