Need PlacementTarget return value

6 posts, 1 answers
  1. Balaji
    Balaji avatar
    19 posts
    Member since:
    Dec 2010

    Posted 07 Aug 2012 Link to this post

    Hi,

    Just I Updated my dlls ver from 2011 Q3 SP1 to 2012 Q2 SP1 (0730)
    After this,

    PlacementTarget of ContextMenu always returning null instead of actual element.

    Is there any issue while getting PlacementTargetValue or is there any alternative for this?

    I tried with GetClickedElement but it is not giving me exact element at most of the places.

    For ex:,
    I was added Context Menu to the parent element and I have some child elements to this parent element.
    At this point of time, GetClickedElement is giving me the child element instead of parent element.
  2. Answer
    Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 07 Aug 2012 Link to this post

    Hi,

    We have changed this behavior because we had some concerns about setting the PlacementTarget property. Anyway to receive the Target you can use the UIElement property of RadContextMenu. It will give you the element on which the RadContextMenu is attached.

    You can contact us if you face any other problems.

    All the best,
    Rosen Vladimirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Keith
    Keith avatar
    2 posts
    Member since:
    Jun 2012

    Posted 24 Jan 2014 Link to this post

    > We have changed this behavior because we had some concerns about setting the PlacementTarget property.


    I don't know if this is useful information but I just lost a few hours to this as I thought I'd broken something else. I'm swapping ContextMenus to RadContextMenus and I really expected PlacementTarget to work the same way.

    Perhaps you would consider a RadPlacementTarget so at least it shows in name-completion when typing PlacementTarget?



    Thanks,

    Keith

  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 27 Jan 2014 Link to this post

    Hi Keith,

    There's no problem when setting PlacementTarget of RadContextMenu. But when you want to get the exact element on which RadContextMenu is attached, you can use UIElement property.

    May I ask you for more details on your issue, so we can assist you further? I'm looking forward to hearing from you.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Keith
    Keith avatar
    2 posts
    Member since:
    Jun 2012

    Posted 27 Jan 2014 in reply to Rosen Vladimirov Link to this post

    Hi Rosen.
    In WPF if I do this:
    ​ <ContextMenu Tag="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
    Then the ContextMenu Tag property is bound to the Tag property of the item that was clicked.

    If I do this:
    <telerik:RadContextMenu Tag="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}" >
    Then the ContextMenu Tag property is always null because PlacementTarget is always null.

    I don't set the PlacementTarget property at all. In the case of ContextMenu the framework sets it for me. In the case of RadContextMenu the framework does not set it. This seems to me inconsistent although I'm sure you have your reasons.

    I just thought that if you can't set PlacementTarget for us you might want to introduce RadPlacementTarget and have it wrap UIElement, to make it clear to developers there is a new PlacementTarget property as I do not think UIElement is intuitive.

    This is what I do now:
    <telerik:RadContextMenu Tag="{Binding UIElement.Tag, RelativeSource={RelativeSource Self}}" >

    It's not a big deal now that I know to use UIElement instead, I just thought I'd give some feedback because I was stumped for a while.

    Thanks for taking the time to reply,

    Keith

  7. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Jan 2014 Link to this post

    Hello Keith,

    Thank you for your explanation. We'll do our best to include a note in our online help, mentioning the difference. We are always happy when our customers share their ideas and once again I want to thank you for the valuable feedback.

    Feel free to contact us in case you have any problems, suggestions or concerns, or add them directly to our feedback portal and our team will take a look at them.

    Regards,
    Rosen Vladimirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready