На самом деле я новичок в wpf.Я хочу отключить расширитель при выборе в выпадающем списке.если выбран индекс = 0, то расширитель должен быть отключен, иначе включить. Я попробовал оба предложения , но в первом ответе я получаю сообщение об ошибке.line ==>
<local:IndexToBoolConverter x:Key="IndexToBoolConverter"/>
и во втором ответе но это мешает взгляду (стилю) расширителя.
Мой код Xaml:
<UserControl x:Class="ABC.UI.Pages.Scan.Create.Base"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="500">
<Grid Style="{StaticResource ContentRoot}">
<Grid.Resources>
<Style x:Key="ExpanderDriven" TargetType="{x:Type Expander}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=SelectedIndex,
ElementName=ComboboxMode}"
Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ExpanderDriven1" TargetType="{x:Type Expander}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=SelectedIndex,
ElementName=ComboboxMode}"
Value="0">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Expander Name="ExpanderDriven1" Header="Driven properties" Margin="0 5 0 0" Style="{StaticResource ExpanderDriven}" IsEnabled="{Binding ElementName=cmbBox, Path=SelectedIndex, Converter={StaticResource IndexToBoolConverter}}"
BorderBrush="{DynamicResource WindowBorder}"
Background="{DynamicResource WindowBorder}">
<StackPanel>
<Grid>
<Label Content="Driving Tag" />
</Grid> </StackPanel></Expander>