Member 3725115 Ответов: 2

Как включить флажок внутри отключенной сетки в WPF/MVVM


Привет,

У меня есть сетка, свойство IsEnabled которой имеет значение FALSE. И эта сетка имеет много дочерних элементов управления внутри нее (метки, текстовые поля, флажки и т. д.). Мне нужно включить только флажки, в то время как свойство IsEnabled сетки имеет значение FALSE. Возможно ли это сделать?

Что я уже пробовал:

<Grid Grid.Row="1" Margin="1 2 2 2" IsEnabled="{Binding EnableEditMode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="50*" MinWidth="375" />
                         <ColumnDefinition  Width="40*"  />
                         <ColumnDefinition  Width="10*"  />
                     </Grid.ColumnDefinitions>
                     <Grid.RowDefinitions>
                         <RowDefinition Height="50*" />
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                         <RowDefinition Height="50*"/>
                     </Grid.RowDefinitions>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="0" >
                         <Label Grid.Column="0" Grid.Row="0" Content="{x:Static resourceDictionary:Resources.TT_LastGeneralOrder}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="1" >
                         <Label Grid.Column="0" Grid.Row="1" Content="{x:Static resourceDictionary:Resources.TT_LastBulletinOrder}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="2" >
                         <Label Grid.Column="0" Grid.Row="2" Content="{x:Static resourceDictionary:Resources.TT_LastGeneralNotice}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="3" >
                         <Label Grid.Column="0" Grid.Row="3" Content="{x:Static resourceDictionary:Resources.CAnd39inEffect}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="4" >
                         <Label Grid.Column="0" Grid.Row="4" Content="{x:Static resourceDictionary:Resources.TT_NewFormM}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="5" >
                         <Label Grid.Column="0" Grid.Row="5" Content="{x:Static resourceDictionary:Resources.TT_FormMInEffect}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="6" >
                         <Label Grid.Column="0" Grid.Row="6" Content="{x:Static resourceDictionary:Resources.TT_NextPlateOrder}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="7" >
                         <Label Grid.Column="0" Grid.Row="7" Content="{x:Static resourceDictionary:Resources.TT_PlateOrderInEffect}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="8" >
                         <Label Grid.Column="0" Grid.Row="8" Content="{x:Static resourceDictionary:Resources.TT_LastOperationsNotice}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="9" >
                         <Label Grid.Column="0" Grid.Row="9" Content="{x:Static resourceDictionary:Resources.TT_PSNoticeinEffect}"
                            Style="{StaticResource LabelStyle}"  />
                     </Border>
                     <Border BorderBrush="LightGray" BorderThickness="1" Grid.ColumnSpan="2" Grid.Row="10" >
                         <StackPanel Orientation="Horizontal">
                             <Label Grid.Column="0" Content="{x:Static resourceDictionary:Resources.TT_RTCNoticeInEffect}"
                            Style="{StaticResource LabelStyle}"  />
                             <CheckBox x:Name="chkRTC" Margin="10" IsChecked="{Binding RTCCheckboxChecked,Mode=TwoWay}"/>
                         </StackPanel>
                     </Border>
                     <telerik:RadWatermarkTextBox Grid.Row="0"  Grid.Column="1"  CurrentText="{Binding LastGeneralOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40">

                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkLastGeneralOrder"  Grid.Row="0"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewLastGeneralOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=2,
                                                              AncestorType={x:Type UserControl}}, Path=DataContext}">
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type Grid}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type Grid}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </CheckBox>


                     <!--<xctk:WatermarkTextBox Grid.Row="0"  Grid.Column="1"  Text="{Binding LastGeneralOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="1"  Grid.Column="1"
                                     CurrentText="{Binding LastBulletinOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40">
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkLastBulletinOrder"  Grid.Row="1"  Grid.Column="2"
                         IsChecked="{Binding Path=ReviewLastBulletinOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1,
                                                              AncestorType={x:Type Grid}}, Path=DataContext}">

                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type Grid}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type Grid}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="1"  Grid.Column="1"
                                     Text="{Binding LastBulletinOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="2"  Grid.Column="1"
                                     CurrentText="{Binding LastGeneralNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" >
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkLastGeneralNotice"  Grid.Row="2"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewLastGeneralNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="2"  Grid.Column="1"
                                     Text="{Binding LastGeneralNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="3"  Grid.Column="1"
                                     CurrentText="{Binding CAnd39InEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40">
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkCAnd39InEffect"  Grid.Row="3"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewCAnd39InEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="3"  Grid.Column="1"
                                     Text="{Binding CAnd39InEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="4"  Grid.Column="1"
                                     CurrentText="{Binding NextFormM,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" >
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkNextFormM"  Grid.Row="4"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewNextFormM,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                            >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="4"  Grid.Column="1"
                                     Text="{Binding NextFormM,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="5"  Grid.Column="1"
                                     CurrentText="{Binding FormMInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" >
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkFormMInEffect"  Grid.Row="5"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewFormMInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="5"  Grid.Column="1"
                                     Text="{Binding FormMInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox  Grid.Row="6"  Grid.Column="1"
                                     CurrentText="{Binding NextPlateOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" >
                     </telerik:RadWatermarkTextBox>
                     <CheckBox x:Name="ChkNextPlateOrder"  Grid.Row="6"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewNextPlateOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="6"  Grid.Column="1"
                                     Text="{Binding NextPlateOrder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox  Grid.Row="7"  Grid.Column="1"
                                     CurrentText="{Binding PlateOrderInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40"></telerik:RadWatermarkTextBox>

                     <CheckBox x:Name="ChkPlateOrderInEffect"  Grid.Row="7"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewNextPlateOrderInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="7"  Grid.Column="1"
                                     Text="{Binding PlateOrderInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="8"  Grid.Column="1"
                                     CurrentText="{Binding LastOperationsNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" ></telerik:RadWatermarkTextBox>

                     <CheckBox x:Name="ChkLastOperationsNotice"  Grid.Row="8"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewLastOperationsNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="8"  Grid.Column="1"
                                     Text="{Binding LastOperationsNotice,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox Grid.Row="9"  Grid.Column="1"
                                     CurrentText="{Binding PsNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" ></telerik:RadWatermarkTextBox>

                     <CheckBox x:Name="ChkPsNoticeInEffect"  Grid.Row="9"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewPsNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="9"  Grid.Column="1"
                                     Text="{Binding PsNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->
                     <telerik:RadWatermarkTextBox  Grid.Row="10"  Grid.Column="1" IsEnabled="{Binding RTCCheckboxChecked,Mode=TwoWay}"
                                     CurrentText="{Binding RtcNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     WatermarkContent="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="9,3,1,7" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" ></telerik:RadWatermarkTextBox>

                     <CheckBox x:Name="ChkRtcNoticeInEffect"  Grid.Row="10"  Grid.Column="2"
                               IsChecked="{Binding Path=ReviewRtcNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                               IsEnabled="{Binding Path=EnableReviewCheckControl,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                             >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}" />
                             </i:EventTrigger>
                             <i:EventTrigger EventName="Unchecked">
                                 <i:InvokeCommandAction Command="{Binding Path=DataContext.ReviewCheckedCommand,RelativeSource={RelativeSource FindAncestor,
                    AncestorType={x:Type UserControl}}}" CommandParameter="{Binding}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>

                     </CheckBox>
                     <!--<xctk:WatermarkTextBox Grid.Row="10"  Grid.Column="1" IsEnabled="{Binding RTCCheckboxChecked,Mode=TwoWay}"
                                     Text="{Binding RtcNoticeInEffect,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                     Watermark="{x:Static resourceDictionary:Resources.EnterText}"
                                     BorderBrush="LightGray" Margin="5" VerticalAlignment="Stretch"
                                     HorizontalAlignment="Stretch" FontSize="16" FontFamily="Arial"
                                     Foreground="#525252" AcceptsReturn="True" TextWrapping="Wrap"
                                     SpellCheck.IsEnabled="True" Language="en-US"
                                     VerticalScrollBarVisibility="Auto" MaxLength="250" MinHeight="40" MaxHeight="40" />-->

                     <!--<TextBox Grid.Row="0" MaxLength="100" Text="{Binding LastGeneralOrder,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="1" MaxLength="100" Text="{Binding LastBulletinOrder,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="2" MaxLength="100" Text="{Binding LastGeneralNotice,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
       <TextBox Grid.Row="3" MaxLength="100" Text="{Binding CAnd39InEffect,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="4" MaxLength="100" Text="{Binding NextFormM,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="5" MaxLength="100" Text="{Binding FormMInEffect,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="6" MaxLength="100" Text="{Binding NextPlateOrder,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="7" MaxLength="100"  Text="{Binding PlateOrderInEffect,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="8" MaxLength="100" Text="{Binding LastOperationsNotice,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />
         <TextBox Grid.Row="9" MaxLength="100" Text="{Binding PsNoticeInEffect,Mode=TwoWay}" Grid.Column="1"  Margin="5"
                              Style="{StaticResource RoundCornerTextBoxStyle}" />-->

                 </Grid>

Richard Deeming

Это кажется невозможным. Установка IsEnabled="False" на родительском устройстве автоматически отключаются его дочерние элементы, даже если вы установили IsEnabled="True" на них.

Я подозреваю, что вам нужно будет отключить определенные дочерние элементы управления, которые вы хотите отключить, а не отключать всю сетку.

TABiSH777

ты не можешь
поскольку сам родитель отключен, что позволяет ребенку быть недоступным, даже если они включены индивидуально.
Следовательно, решение здесь таково, как сказал Ричард: "вам нужно будет отключить определенные дочерние элементы управления, которые вы хотите отключить"

2 Ответов

Рейтинг:
1

Graeme_Grant

Исходя из сложности вашего макета, предложение Клиффорда было бы далеко не оптимальным и не рекомендованным.

Вы можете создать пользовательский элемент управления Grid, унаследовав стандарт Grid управление, добавление нового пользовательского элемента IsEnabledEx Свойство зависимостей и вручную обрабатывать включение/отключение дочерних элементов управления, как это было предложено выше Ричардом и Tabish777...


Рейтинг:
0

Clifford Nelson

У вас есть 2-я сетка, которая накладывается на первую сетку (это просто для того, чтобы вы могли получить правильный размер), и эта сетка имеет только флажки, любые другие элементы управления, необходимые для размера, могут быть установлены в скрытый, а не свернутый. Затем просто можно отключить всю фоновую сетку и оставить сетку переднего плана с включенными флажками.