IsReadOnly on a ComboBox has no effect

Ribbon for WPF Forum

Posted 15 years ago by wpf.acp
Version: 9.1.0507
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
Avatar
I have found this forum post with a similar issue but I am unsure of its status.

It appears as if IsReadOnly property of a ribbon ComboBox has no effect. I have created a sample to reproduce this issue. I would expect IsReadOnly to allow drop list to be displayed but prevent SelectedItem from changing.
<Ribbon:RibbonWindow x:Class="RibbonComboxReadOnlyProblem.Window1"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:Ribbon="clr-namespace:ActiproSoftware.Windows.Controls.Ribbon;assembly=ActiproSoftware.Ribbon.Wpf30"
                     xmlns:System="clr-namespace:System;assembly=mscorlib"
                     xmlns:ribbon="clr-namespace:ActiproSoftware.Windows.Controls.Ribbon.Controls;assembly=ActiproSoftware.Ribbon.Wpf30"
                     Title="Window1"
                     Height="600"
                     Width="800">

    <Ribbon:Ribbon>
        <Ribbon:Ribbon.Tabs>
            <ribbon:Tab Label="Test">
                <ribbon:Group Label="Test">
                    <ribbon:StackPanel ItemVariantBehavior="MediumThenSmallWhenSmall">
                        <ribbon:ComboBox Width="150"
                                         SelectedIndex="0"
                                         SelectedItem="{Binding Text,ElementName=name,Mode=OneWayToSource}"
                                         IsReadOnly="{Binding IsChecked,ElementName=checkbox}">
                            <ribbon:ComboBox.Items>
                                <System:String>#1</System:String>
                                <System:String>#2</System:String>
                                <System:String>#3</System:String>
                            </ribbon:ComboBox.Items>
                        </ribbon:ComboBox>
                        <ribbon:CheckBox Label="IsReadOnly"
                                         x:Name="checkbox" />
                        <ribbon:TextBox x:Name="name"
                                        Width="150"/>
                    </ribbon:StackPanel>
                </ribbon:Group>
            </ribbon:Tab>
        </Ribbon:Ribbon.Tabs>
    </Ribbon:Ribbon>
</Ribbon:RibbonWindow>

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you try a regular WPF ComboBox (which ours inherits) you see the same behavior:
<ComboBox Width="150"
                     SelectedIndex="0"
                     SelectedItem="{Binding Text,ElementName=name,Mode=OneWayToSource}"
                     IsReadOnly="{Binding IsChecked,ElementName=checkbox}">
    <ComboBox.Items>
        <sys:String>#1</sys:String>
        <sys:String>#2</sys:String>
        <sys:String>#3</sys:String>
    </ComboBox.Items>
</ComboBox>
So this is not considered a bug in our control since it is how the core WPF ComboBox works and we inherit that functionality.

You'd want to use IsEnabled to prevent any changing.


Actipro Software Support

Posted 15 years ago by wpf.acp
Avatar
Ok, thanks. I didn't realize that.

I already figured out to use IsEnabled instead.
The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.