RadSplitButton with RadCustomMenus

7 posts, 0 answers
  1. Rajesh
    Rajesh avatar
    25 posts
    Member since:
    Dec 2007

    Posted 04 Mar 2010 Link to this post

    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



     

  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 10 Mar 2010 Link to this post

    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.
  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 10 Mar 2010 Link to this post

    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.
  5. Rajesh
    Rajesh avatar
    25 posts
    Member since:
    Dec 2007

    Posted 10 Mar 2010 Link to this post

    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

  6. Pana
    Admin
    Pana avatar
    748 posts

    Posted 16 Mar 2010 Link to this post

    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.
  7. Rajesh
    Rajesh avatar
    25 posts
    Member since:
    Dec 2007

    Posted 17 Mar 2010 Link to this post

    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
  8. Pana
    Admin
    Pana avatar
    748 posts

    Posted 23 Mar 2010 Link to this post

    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.
Back to Top
DevCraft banner