C# 当comboxbox';在silverlight中处于只读状态,不禁用控件
在我的代码中我有这个C# 当comboxbox';在silverlight中处于只读状态,不禁用控件,c#,.net,silverlight,C#,.net,Silverlight,在我的代码中我有这个 <ComboBox Width="Auto" ItemsSource="{Binding MyItems}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Libelle}" /> </DataTemplate> </ComboBox
<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>
IsReadOnlyBehavior在需要时将comboxbox设置为只读状态。
但当组合框处于只读状态时,我可以通过鼠标滚动来更改值。
是否仍有避免此情况的方法?使用属性值使组合框抑制事件。此方法有效,但无法选择要复制的控件内容。我需要控件内容可供选择以进行复制/粘贴。@ToyiKADJINA这将使组合框完全禁用,您应该编辑您的问题,然后您可以查看此“类似”帖子:在什么上下文中,您需要一个只读组合框?(ComboBox毕竟是一个输入控件。)我问这个问题不是没有理由的,“只读方法”带有某种气味。例如,DataGrid有一个用于只读单元格的内置机制。