Ejemplo n.º 1
0
        public List <DesignablePropertyDescriptor> GetDesignProperties()
        {
            List <DesignablePropertyDescriptor> props = EditServiceHelper.GetDefaultDescriptors();

            DesignablePropertyDescriptor fillColor = new DesignablePropertyDescriptor();

            fillColor.PropertyInfo           = GetType().GetProperty("FillColor");
            fillColor.DisplayName            = "Color";
            fillColor.DisplayType            = typeof(TextBlock);
            fillColor.Editable               = true;
            fillColor.EditorType             = typeof(ComboBox);
            fillColor.SupportsStandardValues = true;
            fillColor.StandardValues         = new List <object>(new object[] { Colors.Purple, Colors.Red, Colors.Gray, Colors.Brown, Colors.Blue, Colors.Green, Colors.Orange });
            fillColor.Converter              = new DamonPayne.AGT.Design.Converters.ColorConverter();
            props.Add(fillColor);

            DesignablePropertyDescriptor softness = new DesignablePropertyDescriptor();

            softness.DisplayName  = "Softness";
            softness.Converter    = null;
            softness.DisplayType  = typeof(SoftnessVisualizer);
            softness.Editable     = true;
            softness.EditorType   = typeof(SoftnessEditor);
            softness.PropertyInfo = GetType().GetProperty("Softness");

            props.Add(softness);


            return(props);
        }
Ejemplo n.º 2
0
        private void VerifyEditVisualization(object sender)
        {
            CheckPreviousEditInstance();
            if (null != Model.Selection && Model.Selection.Count > 0)
            {
                FrameworkElement element = (FrameworkElement)sender;
                var desc = Model.GetDescriptorForDisplayElement(element);
                FrameworkElement editInstance = Model.GetEditElement(desc);
                if (null == editInstance)
                {
                    editInstance = EditServiceHelper.GetEditInstance(Model.Selection[0], desc);
                    if (null != editInstance)
                    {
                    }
                    else
                    {
                        editInstance = new TextBlock
                        {
                            Text = "Unable to edit"
                        };
                    }
                    Model.SetEditElement(desc, editInstance);
                    Model.CurrentEditElement = editInstance;
                }

                if (element != editInstance)
                {
                    SwapToEdit(desc, editInstance);
                }
            }
        }
Ejemplo n.º 3
0
        protected virtual void EditMultiple(IList <IDesignableControl> targets)
        {
            //Get common properties and then do similar to edit single on the first one,
            //CheckPreviousEditInstance() will deal with sets
            List <DesignablePropertyDescriptor> allProps = new List <DesignablePropertyDescriptor>();

            foreach (var idt in targets)
            {
                allProps.AddRange(Inspector.Inspect(idt));
            }
            var hashes = from pd in allProps
                         group pd by pd.GetHashCode() into g
                             where g.Count() == targets.Count
                         select new { g.Key };
            var dups = (from pd in allProps
                        join h in hashes on pd.GetHashCode() equals h.Key
                        select pd).Distinct();


            List <DesignablePropertyDescriptor> common = dups.ToList <DesignablePropertyDescriptor>();

            var propCount = 0;

            foreach (var descriptor in common)
            {
                _propertyPart.RowDefinitions.Add(new RowDefinition());
                TextBlock tb = new TextBlock();
                tb.Text = descriptor.DisplayName;
                tb.SetValue(Grid.RowProperty, propCount);
                tb.SetValue(Grid.ColumnProperty, 0);
                tb.Style = _descriptionTextBlockStyle;
                //
                FrameworkElement displayElement = EditServiceHelper.GetDisplayInstance(targets[0], descriptor);

                if (null == displayElement)
                {
                    displayElement = new TextBlock
                    {
                        Text = "No display element found"
                    };
                }

                displayElement.SetValue(Grid.RowProperty, propCount);
                displayElement.SetValue(Grid.ColumnProperty, 1);
                displayElement.GotFocus            += new RoutedEventHandler(displayElement_GotFocus);
                displayElement.MouseLeftButtonDown += new MouseButtonEventHandler(displayElement_MouseLeftButtonDown);

                Model.SetDisplayElement(descriptor, displayElement);

                _propertyPart.Children.Add(tb);
                _propertyPart.Children.Add(displayElement);
                ++propCount;
            }


            Model.SetProperties(common);
        }
Ejemplo n.º 4
0
        protected virtual void EditSingle(IDesignableControl idt)
        {
            List <DesignablePropertyDescriptor> props = Inspector.Inspect(idt);

            Model.SetProperties(props);
            var propCount = 0;

            foreach (var descriptor in props)
            {
                _propertyPart.RowDefinitions.Add(new RowDefinition());
                TextBlock tb = new TextBlock();
                tb.Text = descriptor.DisplayName;
                tb.SetValue(Grid.RowProperty, propCount);
                tb.SetValue(Grid.ColumnProperty, 0);
                tb.Style = _descriptionTextBlockStyle;
                //
                FrameworkElement displayElement = EditServiceHelper.GetDisplayInstance(idt, descriptor);

                if (null == displayElement)
                {
                    displayElement = new TextBlock
                    {
                        Text = "No display element found"
                    };
                }

                displayElement.SetValue(Grid.RowProperty, propCount);
                displayElement.SetValue(Grid.ColumnProperty, 1);
                displayElement.GotFocus            += new RoutedEventHandler(displayElement_GotFocus);
                displayElement.MouseLeftButtonDown += new MouseButtonEventHandler(displayElement_MouseLeftButtonDown);

                Model.SetDisplayElement(descriptor, displayElement);

                _propertyPart.Children.Add(tb);
                _propertyPart.Children.Add(displayElement);
                ++propCount;
            }
        }
Ejemplo n.º 5
0
 public List <DamonPayne.AGT.Design.Types.DesignablePropertyDescriptor> GetDesignProperties()
 {
     return(EditServiceHelper.GetDefaultDescriptors());
 }
        public List <DesignablePropertyDescriptor> GetDesignProperties()
        {
            var props = EditServiceHelper.GetDefaultDescriptors();

            return(props);
        }