PopupGallery initial selected item and color

Ribbon for WPF Forum

Posted 14 years ago by Arthur Damen
Version: 9.2.0510
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
Avatar
I used a part of the example code to show the problem.
When the ribbon is loaded nothing is selected in the popupgallery.

However in my situation i need the first item to be selected at start!
So I add:

  Public Sub New()

    ' This call is required by the Windows Form Designer.
    InitializeComponent()

    ' Add any initialization after the InitializeComponent() call.

    Test.SelectedItem = Test.Items(0)
  End Sub
that will select the item 0. But when I now click on the splitbutton to show the popupgallery it looks like nothing is selected??? At the back the item is selected but the background color does not change to blue.

Looks like a bug to me.

<ribbon:RibbonWindow x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:mediaImaging="clr-namespace:System.Windows.Media.Imaging;assembly=PresentationCore"
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"    
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
    WindowStartupLocation="CenterScreen"
    ApplicationName="Gallery with Item Categories/Filtering/Zooming Sample" 
    Width="780" Height="560"
    >

    <DockPanel>

        <!-- Ribbon Control -->
        <ribbon:Ribbon x:Name="ribbon" DockPanel.Dock="Top" >
            <!-- 
                Use pre-defined WordApplicationMenu type in the sample project so that we don't have redundant code 
                in this sample that takes away from the focus of the sample
            -->
            <ribbon:Ribbon.Tabs>
                <ribbon:Tab Label="Home">
                    <ribbon:Group Label="Sample">
                        <ribbon:StackPanel ItemVariantBehavior="AlwaysMedium" RowAlignment="Center">
                            <ribbon:SplitButton Label="Bullets" KeyTipAccessText="U" PopupResizeMode="Both">
                                <StackPanel>
                                    <ribbon:PopupGallery Name="Test" InitialColumnCount="6"  >
                                        <ribbon:PopupGallery.CategorizedItemsSource>
                                            <x:Array Type="{x:Type Image}">
                                                <Image ribbon:PopupGallery.Category="Recently1 Used Bullets"  />
                                                <Image ribbon:PopupGallery.Category="Bullet Library"  />
                                                <Image ribbon:PopupGallery.Category="Bullet Library"  />
                                            </x:Array>
                                        </ribbon:PopupGallery.CategorizedItemsSource>
                                        <ribbon:PopupGallery.ItemTemplate>
                                            <DataTemplate>
                                                <Border Margin="2" BorderBrush="#808080" BorderThickness="1" Background="#FFFFFF" 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.ZoomedInItemTemplate>
                                            <DataTemplate>
                                                <Border Margin="2" BorderBrush="#808080" BorderThickness="1" Background="#FFFFFF" Width="70" Height="70" SnapsToDevicePixels="True">
                                                    <Image Source="{Binding BindsDirectlyToSource=True}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True">
                                                        <Image.LayoutTransform>
                                                            <ScaleTransform ScaleX="2" ScaleY="2" />
                                                        </Image.LayoutTransform>
                                                    </Image>
                                                </Border>
                                            </DataTemplate>
                                        </ribbon:PopupGallery.ZoomedInItemTemplate>
                                    </ribbon:PopupGallery>
                                    <ribbon:Separator />
                                    <ribbon:Menu>
                                        <ribbon:PopupButton  Label="Change List Level" />
                                        <ribbon:Button Label="Define New Multilevel List..." />
                                        <ribbon:Button Label="Define New List Style..." />
                                    </ribbon:Menu>
                                </StackPanel>
                            </ribbon:SplitButton>
                        </ribbon:StackPanel>
                    </ribbon:Group>
                </ribbon:Tab>
            </ribbon:Ribbon.Tabs>
        </ribbon:Ribbon>
    </DockPanel>

</ribbon:RibbonWindow>

Comments (1)

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

Thanks for the bug report and we've corrected this for the next maintenance release (due out any day now).


Actipro Software Support

The latest build of this product (v24.1.1) 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.