Setting AllowDrop to false.

Editors for WPF Forum

Posted 7 months ago by Ralph
Version: 19.1.0687
Avatar

I just happened to notice that Actipro edit controls enable drag and drop by default.
This happens to be the default behaviour for a standard TextBox control, you can easily disable this behaviour by setting AllowDrop to False.
However for Actipro contols this on its own does not work.  The only way I can get it to work is by setting the AllowDrop to false (not strictly necessary but without it if your control is larger than the internal edit box depending on where you mouse is, it can look like the control accepts drop) and then handling the Loaded event for each control, by either adding Loaded += EventHandler or by deriving a new class that inherits from the actipro control and wires up the Loaded event for me. Then in the loaded event I need to do

private void OnLoaded(object sender, RoutedEventArgs e)
{
  if (Template.FindName("PART_TextBox", this) is EmbeddedTextBox textBox)
    textBox.AllowDrop = false;
}

This seems like a lot of hassle to set a standard property (but I have run into this a few times with the Actipro controls).
Does anybody know of a better way?

Comments (3)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ralph,

Thanks for reporting this.  We will update all the edit box templates to bind the embedded TextBox.AllowDrop property to the edit box's AllowDrop property, and will update the default edit box AllowDrop to be true.  Then you will be able to just set the edit box's AllowDrop property one way or the other and won't need custom code like what you have now.  This update will be in the next maintenance release.


Actipro Software Support

Posted 7 months ago by Ralph
Avatar

Fantastic, thank you for the good news.

BTW, same problem applies to IsTabStop property.

Just shyly asking: would it be much work to apply the fix to version 19.1.0687 as well?  There are breaking changes between versions 19 and 20 and I'm stuck with the old release (upgrading will require serious changes to themes and styles and I don't have time to do it right now).

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ralph,

We can push the AllowDrop change down to a v19.1 preview build.  Please contact our support address and mention this thread for a download link.

IsTabStop is not something easy to alter though because there, WPF uses those property settings to know if each element supports tab stops.  For editable edit boxes (the default), they have IsTabStop = false, while the embedded TextBox.IsTabStop = true.  Then for non-editable edit boxes, the edit box's IsTabStop becomes true instead.


Actipro Software Support

The latest build of this product (v21.1.3) was released 20 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.