Simple Array Editor?

Editors for WPF Forum

Posted 9 years ago by Justin Klein
Version: 15.1.0623
Avatar

I'm trying to figure out if there's a relatively easy way to edit an array of primitive numeric values (i.e. int/double) in a control similar to your ThicknessEditBox, SizeEditBox, RectEditBox, Int32RectEditBox, CornerRadiusEditBox, etc.  i.e. it would have (some number of) numeric values separated by commas, with a spinner that lets you alter the currently-selected value.  Ideally the array length wouldn't have to be fixed; i.e. it could be used to edit the 9 values in a length-9 array, etc.

I feel like this is likely possible, and that if so it probably starts with a PartEditBox, but I keep getting lost when looking through the sample code.  Any pointers you could give would be appreciated :)

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Justin,

We don't have any pre-defined controls like that.  If you didn't need to limit the control to TextBox-like height, you could use our PropertyGrid since that has array editing features and you can have its value templates use our Int32EditBox/DoubleEditBox controls.  That would be quick and easy to set up.

As for building a custom edit box, that would be more work.  The CustomPartEditBoxSSN QuickStart is probably closest to what you'd need to do.  Although in reality, you might not need your code to be that complex.  You might be able to do something similar to our SizeEditBox for instance where we inherit DoubleEditBoxBase<Size?> but instead, you'd try to inherit something like DoubleEditBoxBase<double[]>.  Similar to the SocialSecurityNumberEditBox example, you'd have to override ConvertFromString, ConvertToString, and GenerateDefaultItems.  GenerateDefaultItems would create a special part group you create like SocialSecurityNumberPartGroup.  It would generate parts that would be a custom double-based part, then literal commas, another instance of the double-based part, and so on.  Then you'd have to do the same as the above for an integer array version.  Hope that helps!


Actipro Software Support

Posted 8 years ago by Justin Klein
Avatar

That's VERY helpful, thanks!  Hopefully should be enough to get me moving :)

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.