Esempio n. 1
0
        private void DeleteProperty_Click(object sender, RoutedEventArgs e)
        {
            MenuItem aMenuItem = sender as MenuItem;
            CustomPropertyDescriptor aCustomPropertyDescriptor = (aMenuItem.Parent as ContextMenu).DataContext as CustomPropertyDescriptor;

            myProperties.Remove(aCustomPropertyDescriptor.Name);
            wndDynamicPropertyGrid.UpdateProperties();
        }
Esempio n. 2
0
        private void AddProperty_Click(object sender, RoutedEventArgs e)
        {
            MenuItem aMenuItem = sender as MenuItem;
            CustomPropertyDescriptor aCustomPropertyDescriptor = (aMenuItem.Parent as ContextMenu).DataContext as CustomPropertyDescriptor;
            AddPropertyWindow        dlg = new AddPropertyWindow();

            dlg.Owner         = FindAncestor <Window>(this);
            dlg.Category      = aCustomPropertyDescriptor.Category;
            dlg.Categories    = myProperties.Categories;
            dlg.PropertyNames = myProperties.PropertyNames;
            if (true == dlg.ShowDialog())
            {
                myProperties.Add(new CustomProperty(dlg.PropertyName, dlg.DefaultValue, typeof(string), false, true, dlg.Category));
                wndDynamicPropertyGrid.UpdateProperties();
            }
        }