Exemple #1
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            try
            {
                //var item = propertyGrid.SelectedObject;
                //var item = propertyGrid.SelectedGridItem.Parent.Value;
                var gi = propertyGrid.SelectedGridItem.Parent;
                while (null == gi.Value)
                {
                    gi = gi.Parent;
                }

                var item = gi.Value;

                var          propertyName = e.ChangedItem.PropertyDescriptor.Name;
                PropertyInfo pi           = item.GetType().GetProperty(propertyName);
                var          oldValue     = e.OldValue;
                var          newValue     = e.ChangedItem.Value;

                if ("Title" == pi.Name)
                {
                    this.CurNode.SetText(null);

                    PageNode pageNode = this.CurNode as PageNode;
                    if (null != pageNode)
                    {
                        pageNode.SetNewTitle(newValue as string);
                    }
                }

                if (null != this.cqp)
                {
                    this.cqp.AddCommand(new NodePropertyInfo(item, pi, oldValue, newValue));
                }

                SetPropertyGridTitle(this.CurNode);

                UCPropertyChangedEventArgs args = new UCPropertyChangedEventArgs();
                args.pi = pi;
                NodePropertyChangeNotify(this.CurNode, args);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }