You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a followup to #325 , I tried to use a DropAdornerTemplateSelector to provide some custom logic to select different templates to display in different conditions.
However, because the CreateDragAdorner implementation just uses a nullable pattern for both sets of properties, it ends up passing a non-null DataTemplate (from DragAdornerTemplate) and a non-null DataTemplateSelector (from DropAdornerTemplateSelector).
Due to the way that ContentPresenter works (a template always wins over a template selector), this means that the drop-level template selector is ignored and only the drag-level template is used.
Expected outcome
If a template or template selector are provided at the Drop level, the Drag level properties should not be read (leaving the corresponding variable null).
Also: it would be nice if a public static property were added so that DragDrop.m_DragInfo could be read externally. Among other things, this would allow such a DataTemplateSelector to use the current drag operation to help decide on which template to use. A suggested implementation is:
public static DragInfo CurrentDragInfo
{
get { return m_DragInProgress ? m_DragInfo : null; }
}
It would also be nice if the DropInfo were similarly available, but that's probably less feasible (and less important). Another possible alternative (which might be much cleaner) is if the DropHandler.DragOver handler could set a template which overrides the standard visual properties.
What steps will reproduce this issue?
As a followup to #325 , I tried to use a
DropAdornerTemplateSelector
to provide some custom logic to select different templates to display in different conditions.However, because the
CreateDragAdorner
implementation just uses a nullable pattern for both sets of properties, it ends up passing a non-nullDataTemplate
(fromDragAdornerTemplate
) and a non-nullDataTemplateSelector
(fromDropAdornerTemplateSelector
).Due to the way that
ContentPresenter
works (a template always wins over a template selector), this means that the drop-level template selector is ignored and only the drag-level template is used.Expected outcome
If a template or template selector are provided at the Drop level, the Drag level properties should not be read (leaving the corresponding variable null).
Also: it would be nice if a public static property were added so that
DragDrop.m_DragInfo
could be read externally. Among other things, this would allow such aDataTemplateSelector
to use the current drag operation to help decide on which template to use. A suggested implementation is:It would also be nice if the
DropInfo
were similarly available, but that's probably less feasible (and less important). Another possible alternative (which might be much cleaner) is if theDropHandler.DragOver
handler could set a template which overrides the standard visual properties.Repo
https://github.com/uecasm/gong-test-1/tree/drop-template-selector
Environment
The text was updated successfully, but these errors were encountered: