0
IsEnabled 속성을 false로 설정하는 쉬운 방법은 없습니까? 단추를 클릭 한 후 CheckBox 컨트롤을 클릭합니다. 버튼이 다른 xaml 파일에 있음을 확인하십시오. 코드없이 xaml에서만 할 수 있습니까?usercontrol에있는 다른 컨트롤의 작업을 기반으로 CheckBox 컨트롤의 isEnabled 속성을 설정합니다.
MainWindow.xaml
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1" x:Class="WpfApplication1.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<CheckBox Grid.Row="0" Content="CheckBox" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<local:UserControl1 HorizontalAlignment="Left" Margin="31,54,0,0" Grid.Row="1" VerticalAlignment="Top"/>
</Grid>
</Window>
UserControl1.xaml
<UserControl x:Class="WpfApplication1.UserControl1"
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"
mc:Ignorable="d"
>
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Width="75"/>
</Grid>
</UserControl>
코드 숨김 또는보기 모드에서 코드를 사용해야합니다. afmA XAML에서이를 수행 할 방법이 없습니다. – JMK