Error trying to create "sub-toolbars"

5 posts, 1 answers
  1. Pinho
    Pinho avatar
    42 posts
    Member since:
    Mar 2009

    Posted 19 Jun 2009 Link to this post

    Hi,

     I'm using the toolbar control do define a toolbar on top of a control.

     I'm defining the toolbar on the generic.xaml because the the control I'm developing needs to have "content":

     <Style TargetType="local:GridToolbar">  
            <Setter Property="Template">  
                <Setter.Value> 
                    <ControlTemplate TargetType="local:GridToolbar">  
                        <Grid> 
                            <Grid.RowDefinitions> 
                                <RowDefinition Height="Auto"></RowDefinition> 
                                <RowDefinition Height="Auto"></RowDefinition> 
                            </Grid.RowDefinitions> 
                            <!-- This the header. --> 
     
                            <Grid x:Name="LayoutRoot" Background="White">  
                                <Grid.RowDefinitions> 
                                    <RowDefinition Height="25"/>  
                                    <RowDefinition Height="Auto"/>  
                                </Grid.RowDefinitions> 
                                <Grid.ColumnDefinitions> 
                                    <ColumnDefinition Width="Auto" /> 
                                    <ColumnDefinition Width="*"/>  
                                </Grid.ColumnDefinitions> 
                                <TextBlock Grid.Column="0" Grid.Row="0"  x:Name="txtLabel" VerticalAlignment="Center" Margin="3" FontWeight="Bold" /> 
                                <telerikNavigation:RadToolBar Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right">  
                                    <telerikNavigation:RadMenuItem x:Name="menuItemAdd"  Width="25" > 
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgAdd" Source="/AssemblyName;component/Images/add-16x16.png" Width="16" Height="16" /> 
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadMenuItem x:Name="menuItemDelete" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgDelete" Source="/AssemblyName;component/Images/delete-16x16.png"  Width="16" Height="16"/>  
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadSeparator x:Name="menuItemSeparatorLeft"/>  
                                    <telerikNavigation:RadMenuItem x:Name="menuItemExport" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgExport" Source="/AssemblyName;component/Images/export-16x16.png"  Width="16" Height="16"/>  
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadMenuItem x:Name="menuItemFavorites" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgFavorites" Source="/AssemblyName;component/Images/Favorites-16x16.png"  Width="16" Height="16"/>  
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadMenuItem x:Name="menuItemEdit" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgEdit" Source="/AssemblyName;component/Images/edit-16x16.png"  Width="16" Height="16"/>  
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadSeparator x:Name="menuItemSeparatorRight"/>  
                                    <telerikNavigation:RadMenuItem x:Name="menuItemRefresh" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgRefresh" Source="/AssemblyName;component/Images/refresh-16x16.png"  Width="16" Height="16"/>  
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                    <telerikNavigation:RadMenuItem x:Name="menuItemExecute" Width="25">  
                                        <telerikNavigation:RadMenuItem.Icon> 
                                            <Image x:Name="imgExecute" Source="/AssemblyName;component/Images/simplistica/16x16/accept.png" Width="16" Height="16" /> 
                                        </telerikNavigation:RadMenuItem.Icon> 
                                    </telerikNavigation:RadMenuItem> 
                                </telerikNavigation:RadToolBar> 
                            </Grid> 
                            <!-- This is the content. --> 
                            <ContentPresenter Grid.Row="1" x:Name="Content" Content="{TemplateBinding Content}" Height="Auto" Width="Auto"/>  
                        </Grid> 
                    </ControlTemplate> 
                </Setter.Value> 
            </Setter> 
        </Style> 

    If I try to add a MenuItem, to a menu item (a sub-menu), I'm always getting one of those errors AG_....

    In your example you do that, is this not possible if I define this on generic.xaml?

    Thanks,

    L. Pinho
  2. Answer
    Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 24 Jun 2009 Link to this post

    Hello Luis,

    There should not be problems to embed the RadToolBar and RadMenu inside a UserControl. For your convenience we prepared an example and attached it to the thread. This example demonstrates a custom control with both the RadToolBar and the RadMenu. Please preview it and let me know if the problem persists in your application.

    More information about the RadMenu and RadMenuItem you can find in links below:

    We hope this information will help you.

    Best wishes,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Pinho
    Pinho avatar
    42 posts
    Member since:
    Mar 2009

    Posted 26 Jun 2009 Link to this post

    Hi Ivan,

     If I use a RadMenu inside the toolbar, it works, I then have to change some things to avoid the appearance of a line over the menu items.

     I was trying to do this without creating a RadMenu inside the toolbar, but if this is the only way, I will use it.

    Thanks,

    L. Pinho
  5. Ivan
    Admin
    Ivan avatar
    519 posts

    Posted 26 Jun 2009 Link to this post

    Hi Luis,

    Try to set menu's background to transparent and its border to zero. If the menu still not fits to your vision you can edit its style too.

    Please give it a try and let me know if you need further assistance.

    Greetings,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Pinho
    Pinho avatar
    42 posts
    Member since:
    Mar 2009

    Posted 26 Jun 2009 Link to this post

    Hi Ivan,

     that's exacly what I did, thanks

    L. Pinho
Back to Top
DevCraft banner