Question

Using a usercontrol (splitbutton) in the ribbonbar

Posted 5 years ago by Avatar Arthur Damen
Hi,
I have a usercontrol that contains a Actipro Splitbutton which I want to embed into my actipro ribbonbar.

Copying the code directly into the ribbonbar works fine.
However, when I add the usercontrol to the ribbonbar, it shows the openstate, and not the splitbutton. Do I have to do some extra things to get a custom usercontrol into the ribbonbar which behaves the same as when i copy the code directly into the ribbonbar?
<UserControl x:Class="NdsTransitionControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  Focusable="False">
    <Grid HorizontalAlignment="Left" VerticalAlignment="Top" >
        <ribbon:SplitButton Label="Transition" HorizontalAlignment="Left" VerticalAlignment="Top" >
          <ribbon:PopupGallery Name="PageTransitionGallery"  InitialColumnCount="7" >
                <ribbon:PopupGallery.CategorizedItemsSource>
                    <x:Array Type="{x:Type Image}">
                        <Image ribbon:PopupGallery.Category="No Transition" Source="{x:Static SomeResourceLink:somepicture}"></Image>
                        <Image ribbon:PopupGallery.Category="Faders" ToolTip="Fade In"   Source="{x:Static SomeResourceLink:somepicture}"></Image>
                        <Image ribbon:PopupGallery.Category="Faders" ToolTip="Dissolve"  Source="{x:Static SomeResourceLink:somepicture}"></Image>
                    </x:Array>
                </ribbon:PopupGallery.CategorizedItemsSource>
                <ribbon:PopupGallery.ItemTemplate>
                    <DataTemplate>
                        <Border Margin="2" BorderBrush="#808080" BorderThickness="1"  Width="40" Height="40" SnapsToDevicePixels="True">
                            <Image Source="{Binding Path=Source}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True" />
                        </Border>
                    </DataTemplate>
                </ribbon:PopupGallery.ItemTemplate>
            </ribbon:PopupGallery>
        </ribbon:SplitButton>
    </Grid>
</UserControl>

Comments (4)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Arthur,

Ribbon has special code that will collapse built-in ribbon controls to different variant sizes depending on available width. However if you embed those ribbon controls within a UserControl, you will prevent that functionality from working.

Actipro Software Support
Posted 5 years ago by Arthur Damen
The usercontrol itself has no width/height specified. So the container where this control is located into should be able to resize it automatically.
Posted 5 years ago by Arthur Damen
What I did now is the following:

Instead of the splitbutton and popupgallery I now added only the popupgallery in the usercontrol. The splitbutton is in the ribbonbar. This way it works.
 <ribbon:SplitButton >
   <base:TransitionControl ></base:TransitionControl>
 </ribbon:SplitButton>
Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Arthur,

If you think there is a problem with the UserControl sizing, please email us a simple sample project that shows the issue and we'll be happy to take a look. Thanks.

Actipro Software Support
Information The latest build of this product (2014.2 build 0610) was released 20 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.