私はコンボボックスの編集/選択をブロックしたいと思います。私はcmbbox.IsReadOnly = True
とcmbbox.IsEditable = False
を使ってみました。これはユーザーがalt
とarrow' keys
で選択を変更できるようにしました。 cmbbox.isEnabled = False
が動作し、私の要件は、コンボボックスのフォアグラウンドカラーを無効にしたときに「ブラック」に変更することです。誰でもそれを修正するために私を助けてくれる? XAMLで無効状態でコンボボックスのフォアグラウンドを変更するにはどうすればよいですか?
:分離コードで
<telerik:RadComboBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" x:Name="combobox1" IsEditable="True" IsFilteringEnabled="True" ItemsSource="{Binding}" TabIndex="7" Style="{ DynamicResource DropDownListStyle }" IsTabStop="True" KeyboardNavigation.TabNavigation ="Local" SelectAllTextEvent="None" Height="23" Margin="0,0,0,2" VerticalAlignment="Center"/>
:スタイルで
combobox1.IsEnabled = False
:
<Style x:Name="DropDownListStyle" x:Key="DropDownListStyle" TargetType="telerik:RadComboBox" >
<Setter Property="Foreground" Value="#FF000000"/>
<Setter Property="BorderBrush" Value="#ffcccccc"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="Thin"/>
<Setter Property="FontFamily" Value="Trebuchet MS"/>
<Setter Property="Panel.ZIndex" Value="10" />
<Setter Property="Height" Value="23" />
<!-- <Setter Property="Focusable" Value="True"/> -->
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
あなたのコード –
のいくつかは、実際に、あなたの質問を編集し、あなたがこれまでに書いたコードを追加するとよいでしょう共有してください:[最小、コンプリートを作成する方法、および検証可能な例?](http://stackoverflow.com/help/mcve) –