WPF ToolBar: problem with CurrentItem

H

Haiping

Hello,

I need drag a ToolBar item into a window. I did the following
implementation. I don't know why the myToolBar.Items.CurrentItem is null. I
think the MouseMove event on a ToolBar should return me a ToolBar item.

In Xaml file:
<ToolBar x:Name="myToolBar" MouseMove="OnMyToolBar_MouseMove">

In Xaml.cs file:
private void OnMyToolBar_MouseMove(object sender, MouseEventArgs
theMouseEventArgs)
{
if (theMouseEventArgs.LeftButton == MouseButtonState.Pressed &&
(myToolBar.Items.CurrentItem != null))
{
}
}

Thanks for any inputs.
 
H

Haiping

I found way to get around this problem. Instead of put MouseMove event
handle on ToolBar I put it in each ToolBar buttons. The drag and drop works
nicely.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top