RangeTypeSpecificEditBoxBase questions

Editors for WPF Forum

Posted 8 years ago by John Dunn
Version: 11.1.0544
Avatar
I have a couple of questions about using the RangeTypeSpecificEditBoxBase. I'm attempting to refine my IpAddress editor using RangeTypeSpecificEditBoxBase and have a couple of user interface 'quirks' that I'd like to resolve. I can post my code if necessary.

1. What's the proper place to validate a RangeTypeSpecificEditBoxBase when the validation cannot be done on a single part? In my case I need to make sure an IP Address is a valid Net Mask which needs to look at the whole address and not just a single octet.

2. It's not possible to drag select all fields. Is there a way to enable this?

3. If you select all fields with Ctrl+A and hit delete it doesn't clear all the fields.

4. The fields start out as showing '•'. If a field is selected and then deleted it reverts back to the field value it was. I tried setting IsNullAllowed on the Part but that caused all parts to null out when a single one was changed. My IP Address allows for each octet to be nullable ( byte? ).

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi John,

1. You can override the RangeTypeSpecificEditBoxBase.CoerceValue method and apply your net mask there. I'm not sure if you want to have the various parts be smarter about what is allowed to be entered, but that certainly makes things more complex.

2. No, that is not currently possible when using multiple parts in the edit box, which you can think of any just multiple TextBox controls (even though they look like a single control). We do support selecting the part group, which holds the parts. For example, in our DateTimeEditBox you can press Ctrl+A twice (once to select part, then once to select part group) and then you can copy/paste an entire date/time value.

3. You would need to ensure that IsNullAllowed is set to true, as that controls whether the end-user can also set the current value to null (i.e. delete) by selecting the associated part group and pressing the Delete key.

4. Normally, you'd just set IsNullAllowed on the edit box. But you would need to ensure that your TryGetEffectiveValue method overload on your part(s) used this value, something like:
protected override bool TryGetEffectiveValue(string stringValue, out IPAddress value) {
    value = null;
    if (string.IsNullOrEmpty(stringValue))
        return this.IsNullAllowed;

    // TODO: Convert stringValue into IPAddress
    return true;
}
If this doesn't help please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.