0

I am populating a FixedDocument as part of a reporting feature. I do not have control over the hows or whys of the approach, just that this is the approach used.

So I programmatically add rows to the page grid, add text controls to show the data, etc. It works.

Now I am trying to add support so that a user can click on an item in the report and I can open that item in an edit window. The only problem I am having is identifying what the user clicked on.

The FixedDocument captures the mouse clicks and ignored the mouseclick event added to the textbox.

As I add the textboxes, if I can keep track of the actual coordinates of the item added, then I can reference that via the code in the FixedDocument click event (since I have the coordinates or where the user clicked.)

What is an easy way for me to get an object reference or information about the item over which the user clicked?

I tried searching , but nothing seemed to address this given all the search terms I could think of using.

Thanks

JustMeToo
  • 325
  • 1
  • 14

1 Answers1

1

Try listening to PreviewMouseLeftButtonUp event of your fixed document. It exposes MouseButtonEventArgs parameter from where you can lookup OriginalSource and compare it with your textbox and perform the necessary action.

You can choose to use any other Preview prefixed event for your benefit wherever you have a similar need.

Kajal Sinha
  • 1,565
  • 11
  • 20
  • I use this (so I can open the item under the mouse), but can I use it to allow the user to drag the selected item to a new location on the FixedDocument? If so, do you have a link to an example? – JustMeToo Aug 06 '14 at 23:42