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

RadSplitButton with RadCustomMenus

6 Answers 107 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Rajesh
Top achievements
Rank 1
Rajesh asked on 04 Mar 2010, 06:37 AM
Hi

I have uploaded a sample project on url -
http://cid-2b9bf77533900b84.skydrive.live.com/self.aspx/.Public/Tutorial5.zip

In this sample there are two list boxes uses different templates "MyItemTemplate" and "MyItemTemplate1".

1. In "MyItemTemplate1" clicking on drop down button raises error.
   I guess it is because of binding done for context menu and failes to display the shapes for each menu.
   Only menu text is shown.  -- > I guess it is not possible to bind this way [This template is not binding child items but properties of same object].  The required items which needs to binded is done using "MyItemTemplate" and I have following issue with "MYItemTemplate".

2. With "MyItemTemplate" , shapes are shown properly but it is not shown in Icon Placeholder.
   Also I need to control the height of these menu item similar to the split~Button.
   Specifing height = 35 in ExtraMenu template doesn't give expected effect.

   Also, if you see the mouse over behavior on these context menu item, there are two borders shown before the shape and after menu text.

Will you please help in fixing the issue with "MyItemTemplate". Also I don't want to specify fixed width and height for these menu items.

-Rajesh



 

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Mar 2010, 09:40 AM
Hello Rajesh,

Please, accept our apologies for the late reply. There is no need to use this code:
<telerikNavigation:RadMenuItem Header="Shape1"  Width="300">
    <telerikNavigation:RadMenuItem.Icon>
         <Path Stretch="Uniform"  Fill="{Binding Brush1}" />
    </telerikNavigation:RadMenuItem.Icon>
 </telerikNavigation:RadMenuItem>
 <telerikNavigation:RadMenuItem Header="Shape2" Width="300">
    <telerikNavigation:RadMenuItem.Icon>
        <Path Stretch="Uniform"  Fill="{Binding Brush1}" />
    </telerikNavigation:RadMenuItem.Icon>
 </telerikNavigation:RadMenuItem>
 because you have already bound the Shapes
<telerikNavigation:RadContextMenu BorderThickness="0" ItemsSource="{Binding ChildItems}" ItemTemplate="{StaticResource ExtraMenu}">



Greetings,
Dimitrina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Dimitrina
Telerik team
answered on 10 Mar 2010, 10:02 AM
Hello Rajesh,

I am following up my colleague's response with an  updated version of your project (see attachment) and a small clarification regarding the SplitButton. It is not part of the control's logic to update it's content when something is selected from its dropdown content, simply because there is no restriction on what you can place in the dropdown. While it will be fairly straightforward to update the content of the button if it is used directly in a page, it would be very hard to update it when the control is used in a DataTemplate. Can you please consider using a RadComboBox in the DataTemplate instead? This way the control will take care of updating its content.

Greetings,
Dimitrina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rajesh
Top achievements
Rank 1
answered on 10 Mar 2010, 03:42 PM
Hi

Thanks for your reply.

Can't we have something like in the post 
http://www.telerik.com/community/forums/silverlight/menu/binding-quot-radmenuitem-icon-quot-and-quot-radmenuitem-header-quot-properties-to-element-in-a-hierarchical-data-structure.aspx

See the Reply posted on Posted on Apr 22, 2009


In that attached sample, I won't be able to see the menu text. Images are visible.

How one can show the Geometry objects and specifiy the fill color for same.

My issue is same which is reported in post and shown in fig.

-Rajesh

0
Pana
Telerik team
answered on 16 Mar 2010, 04:35 PM
Hello Rajesh,

Here you could make a good use of IconTemplate property... unfortunately RadMenuItem does not have one.

The Geometry is not shareable so if you use it as source in 2 or 3 menus it will display only in the first. Eventually it will fail silently in the second and the third or will throw an exception. Images does not have this problem since you can provide ImageSource that will work fine for image

You can create custom style for the menu which defines new styles for the menu items (there are 4 types of them) and replace the ContentPresenters there responsible for the icons with something that will change it's content based on the data you provide for icon. For example you can replace the ContentPresenter with ContentControl and assign its template to the icon data with 'IconTypeToTemplate' converter, it's Foreground and Background to the Color1 and Color2 properties. Than you may use 'square', 'rectangle', 'triangle' enumeration as data and the converter will set ControlTemplate's Template with one that has Paths with the proper shape and Fill and Stroke brushes bound to TemplateBinding to Foreground and Background. And this is a lot of overkill.

Regards,
Panayot
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rajesh
Top achievements
Rank 1
answered on 17 Mar 2010, 10:30 AM
Hi

In one of the reply, sample is provided ( as I described in my query the link for other question in same forum).

That sample uses images. And in that sample images are displayed but not the menu text.

Can you help me in that solution?

-Rajesh
0
Pana
Telerik team
answered on 23 Mar 2010, 08:53 AM
Hi Rajesh,

I'm attaching an example that uses view model as provider for menu. It uses a converter that gets icon description data and converts it to geometry. This way the converter will create different geometry for the different menus.

I hope the example will help you.

Sincerely yours,
Panayot
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Buttons
Asked by
Rajesh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Rajesh
Top achievements
Rank 1
Pana
Telerik team
Share this question
or