Hello,
I am trying to override the TreeListBoxItemAdapter.OnDragHover function so that I can selectively choose whether to auto-expand based on the type of the model
However, unlike the other overridable functions (e.g. OnDrop), I am not having success casting targetItem into the model type I expect.
It seems that in this function, targetItem is an unknown ActiproSoftware.Internal type (TreeNode?) and it is wrapping the model. I am not sure how to get at the model that I need.
public override TreeItemExpandability OnDragHover(DragEventArgs e, TreeListBox targetControl, object targetItem)
{
// this cast fails. targetItem is an unknown type wrapping the TreeNodeModel
var targetModel = targetItem as TreeNodeModel;
return base.OnDragHover(e, targetControl, targetItem);
}
I expected this function to work similar to OnDrop, and I would be able to cast to my expected model type like this:
public override void OnDrop(DragEventArgs e, TreeListBox targetControl, object targetItem, TreeItemDropArea dropArea) {
var originalEffects = e.Effects;
e.Effects = DragDropEffects.None;
// If the drag is over an item and there is item data present...
var targetModel = targetItem as TreeNodeModel;
I could use some guidance or an example on how to properly override OnDragHover to cast the targetItem to its proper type and get the model within it.
Thank you