Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight - Passing mouse coords from UI View to ViewModel
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. CONormally I'd suggest just passing in `Rectangle2` into the `GetPosition` call (`var point = mouseEventArgs.GetPosition(Rectangle2);`) but you're saying you don't have a reference to that object? EDIT: Doesn't the mouse move event pass in a sender? Are you throwing that out when you attach the event? If so, keep the sender and pass that into the `GetPosition` call.
      singulars
    2. COI can have a reference, but if i'm not mistaken, the rule is that the ViewModel doesn't know about the elements in the UI and vice versa. I'm trying to find a way to make the coords relative to the UIElement with out passing the UIElement. But now that I think about it, It is not that I am referring to a certain element on the UI, i'm casting to a general UIElement. What do you think?
      singulars
    3. COAs far as I'm concerned, tracking the mouse position is part of the view anyway. The view would communicate the _relevant_ position down to the view model (if truly necessary). I don't think your "view" _must_ only exist as part of the XAML. Maybe it's _possible_ to do it, but I don't think it's worth bending over backwards for. I don't think it's a violation that when you receive a UI event, that you receive its _sender_ (in fact, that's _standard_). Have the View handle determining the relative coordinates, then send that value to your ViewModel.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload