Need help with RibbonGallery

Ribbon for WPF Forum

Posted 16 years ago by LaurentB - Intersystems

I want to create a RibbonGallery that contains Labels. I can display it fine, but if I open the list and then close, the labels desappear. Where are they ?

This is the XAML of my Window :

<ribbon:RibbonWindow x:Class="WpfApplication4.RibbonWindow1"
    ApplicationName="RibbonWindow1" Width="620" Height="420">

            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        <ribbon:Ribbon x:Name="ribbon" Grid.Row="0">
                <ribbon:Tab Label="Home" KeyTipAccessText="H">
                    <ribbon:Group Label="New Group">
                        <ribbon:RibbonGallery IsSelectionHighlightVisible="False">
                                <x:Array Type="{x:Type Label}">
                                    <Label Content="sss1"/>
                                    <Label Content="sss2"/>
                                    <Label Content="sss3"/>
                                    <Label Content="sss4"/>
                                    <Label Content="sss5"/>
                                    <Label Content="sss6"/>
                                    <Label Content="sss7"/>
                                    <Label Content="sss8"/>
                                    <Label Content="sss9"/>
                                    <Label Content="sss10"/>
                                    <Label Content="{Binding BindsDirectlyToSource=True}" />
                                    <ribbon:PopupGallery InitialColumnCount="4" IsSelectionHighlightVisible="False"
                                        ItemTemplate="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ribbon:RibbonGallery}}, Path=ItemTemplate, Mode=Default}" 
                                        ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ribbon:RibbonGallery}}, Path=ItemsSource, Mode=Default}"
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ActiproSoftware.Windows.Controls.Ribbon.Controls;

namespace WpfApplication4

/// <summary>
/// Interaction logic for RibbonWindow1.xaml.
/// </summary>
public partial class RibbonWindow1 : ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow

public RibbonWindow1()


Many thanks

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
The problem here is that you are trying to use a Visual in two places: in-ribbon gallery and the popup gallery. When the popup gallery shows, it removes the Visuals from the in-ribbon gallery and shows them in the popup. That is just how WPF works since Visuals can only be used in one spot at a time.

Instead of using Visuals as an ItemsSource, you need to bind an array of objects or strings, etc. Since those sorts of data items aren't Visuals, they can freely be used between both gallery instances without any issues like this.

Actipro Software Support

Posted 16 years ago by LaurentB - Intersystems
OK, I understand

Many thanks
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.