0

In my code I have this

<ComboBox Width="Auto"
          ItemsSource="{Binding MyItems}">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Libelle}" />
        </DataTemplate>
    </ComboBox.ItemTemplate>
    <i:Interaction.Behaviors>
        <bh:IsReadOnlyBehavior
            IsReadOnly="{Binding Item.IsReadOnly, Mode=OneWay}" />
    </i:Interaction.Behaviors>
</ComboBox>

The IsReadOnlyBehavior set the comboxbox on readonly state when needed. But when the combobox is in readonly state, I can change value whith scrolling with my mouse. Is there anyway to avoid this?

Toyi KADJINA
  • 3
  • 3
  • 5
  • You can have a look on this "similar" post : http://stackoverflow.com/questions/1882993/c-sharp-how-do-i-prevent-mousewheel-scrolling-in-my-combobox – Ben Jul 01 '14 at 12:10
  • In what context do you need to have a readonly ComboBox? (ComboBox is an input control after all.) I ask this question not without reason, the "readonly approach" bears a certain scent. The DataGrid for example has an inbuilt mechanism for readonly cells. – Martin Jul 02 '14 at 13:12

1 Answers1

1

Use IsHitVisible="False" property value to make the Combobox suppress events.

GregC
  • 7,737
  • 2
  • 53
  • 67
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396