小编tri*_*adh的帖子

选中后更改单选按钮的图像

<StackPanel Name="StpAddDel" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
   <RadioButton Name="rdbactive" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="50" Height="15" Foreground="Blue">
      <RadioButton.Style>
         <Style TargetType="{x:Type RadioButton}">
            <Setter Property="Template">
               <Setter.Value>
                  <ControlTemplate TargetType="{x:Type RadioButton}">
                     <Grid>
                        <Image Source="c:\image.png" Width="32" Height="32"/>
                        <ContentPresenter/>
                     </Grid>
                  </ControlTemplate>
               </Setter.Value>
            </Setter>
         </Style>
      </RadioButton.Style>
   </RadioButton>
   <RadioButton Name="rdbinactive" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="60" Height="15" Foreground="Blue">
      <RadioButton.Style>
         <Style TargetType="{x:Type RadioButton}">
            <Setter Property="Template">
               <Setter.Value>
                  <ControlTemplate TargetType="{x:Type RadioButton}">
                     <Grid>
                        <Image Source="c:\image.png" Width="32" Height="32"/>
                        <ContentPresenter/>
                     </Grid>
                  </ControlTemplate>
               </Setter.Value>
            </Setter>
         </Style>
      </RadioButton.Style>
   </RadioButton>
   <Button Name="BtnAdd"  Height="20" Width="20" Margin="5,0" Template="{StaticResource AddImgBtnTemplate}" />
   <Button Name="BtnDel" Height="20" Width="20" Margin="5,0" …
Run Code Online (Sandbox Code Playgroud)

wpf xaml mvvm

1
推荐指数
1
解决办法
2339
查看次数

使用触发器检查复选框

我有两个复选框 chkone、chktwo。当我尝试检查第一个复选框(chkone)时,我禁用第二个复选框并且 ischeckd 为 true,但是当我执行时禁用正常工作但 ischecked 不工作?

       <CheckBox x:Name="chkone"
                                      Content="QA Review Mandatory" Margin="22,12,289,275"
                                  IsChecked="{Binding Ischkone}"/>
            <CheckBox  x:Name="chktwo"
                                   Content="Question Mandatory" HorizontalAlignment="Left"
                                   Margin="22,85,0,201" IsChecked="{Binding Ischktwo}">
                <CheckBox.Style>
                    <Style TargetType="CheckBox">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=chkone,Path=IsChecked}" Value="True">
                                <Setter Property="IsChecked" Value="True"/>
                                <Setter Property="IsEnabled" Value="False"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding ElementName=chkone,Path=IsChecked}" Value="False">
                                <Setter Property="IsChecked" Value="False"/>
                                <Setter Property="IsEnabled" Value="True"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </CheckBox.Style>
            </CheckBox>
Run Code Online (Sandbox Code Playgroud)

wpf xaml mvvm

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

mvvm ×2

wpf ×2

xaml ×2