This is a migrated thread and some comments may be shown as answers.

Need PlacementTarget return value

5 Answers 253 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Balaji
Top achievements
Rank 1
Balaji asked on 07 Aug 2012, 10:00 AM
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.

5 Answers, 1 is accepted

Sort by
0
Accepted
Rosen Vladimirov
Telerik team
answered on 07 Aug 2012, 11:19 AM
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.

0
Keith
Top achievements
Rank 1
answered on 25 Jan 2014, 12:25 AM

> 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

0
Rosen Vladimirov
Telerik team
answered on 27 Jan 2014, 08:33 AM
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 >>
0
Keith
Top achievements
Rank 1
answered on 27 Jan 2014, 11:13 AM
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

0
Rosen Vladimirov
Telerik team
answered on 30 Jan 2014, 07:43 AM
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 >>
Tags
ContextMenu
Asked by
Balaji
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Keith
Top achievements
Rank 1
Share this question
or