L
Lloyd Dupont
I am working on some drag and drop code.
When some data is moved over a target which accept it I want to show a data
preview.
For this I attempt to create an UIElement with the default DataTemplate.
Problem is, I don't know how to setup the UIElement returned by the
DataTemplate! (i.e. setup it binding correctly)
===== pseudo code: =======
IDataObject ido = ......;
object data = ido.GetData("some key");
FrameworkElement target = sender as FrameworkElement;
DataTemplate dt = target.FindResource(data.GetType()) as DataTemplate;
UIElement ui = dt.LoadContent() as UIElement;
// NOW HOW DO I SET UP DATA BINDING?
ui.....= .....
==================
PS: I do need to get the UIElement, as I measure it to position it
relatively to the mouse position.
When some data is moved over a target which accept it I want to show a data
preview.
For this I attempt to create an UIElement with the default DataTemplate.
Problem is, I don't know how to setup the UIElement returned by the
DataTemplate! (i.e. setup it binding correctly)
===== pseudo code: =======
IDataObject ido = ......;
object data = ido.GetData("some key");
FrameworkElement target = sender as FrameworkElement;
DataTemplate dt = target.FindResource(data.GetType()) as DataTemplate;
UIElement ui = dt.LoadContent() as UIElement;
// NOW HOW DO I SET UP DATA BINDING?
ui.....= .....
==================
PS: I do need to get the UIElement, as I measure it to position it
relatively to the mouse position.