Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Not able to save value in WPF PropertyGrid collection control.

$
0
0
Hello Guys, I need help in fixing the issue. I have a class with property as shown below,
 /// <summary>
    /// To verify assembly and there versions
    /// </summary>
    [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
    public class Assembly
    {
      /// <summary>
      /// Assembly Name
      /// </summary>
      public string Name { get; set; }
      /// <summary>
      /// Assembly versions
      /// </summary>
      public string[] Versions { get; set; }
    }

    /// <summary>
    /// The expected assembly versions.
    /// </summary>
    [DescriptionAttribute("The expected assembly versions.")]
    [Category("Mandatory")]
    public Assembly[] ExpectedAssemblyVersions
    {
      get;
      set;
    }
I am using reflection to load the dll which has above class, In the property grid, I am able to open the collection and also view items, but if I add an item and click on OK button, I get an exception. Exception Details:
   at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
   at System.Array.SetValue(Object value, Int32 index)
   at System.Array.System.Collections.IList.set_Item(Int32 index, Object value)
   at Xceed.Wpf.Toolkit.CollectionControl.PersistChanges()
   at Xceed.Wpf.Toolkit.CollectionControlDialog.OkButton_Click(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
and my Xaml looks like this:
<avalondock:LayoutAnchorable ContentId="Test" Title="Property Explorer">
                                <xctk:PropertyGrid Name="pk" Foreground="{Binding SelectedTheme.FontShade}" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" FontWeight="ExtraBold"  Background="{Binding SelectedTheme.DarkShade}" SelectedObject="{Binding SelectedElement,UpdateSourceTrigger=PropertyChanged}"/>
                            </avalondock:LayoutAnchorable>
Since I am using a custom editor, do I need to implement Xceed.Wpf.Toolkit.PropertyGrid.Editors.ITypeEditor?

any help would be appreciated.

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>