나는 Window
및 Page
있습니다. Window
에는 기본적으로 사용하지 않는 3 개의 버튼이 있습니다. Page
에는 버튼을 하나 클릭하여 10 번 클릭하면 메시지가 표시되고 Window
의 버튼을 사용하도록 설정해야합니다.WPF vb.net 클릭 이벤트가 발생한 후 창 활성화 버튼에 페이지
Page
버튼을 10 번 클릭 한 후 어떻게 3 개의 버튼을 활성화 했습니까?
MainWindow를 XAML :
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="Window1Grid">
<Grid x:Name="FrameGrid">
<Button IsEnabled="False" Content="Button" Height="23" HorizontalAlignment="Left" Margin="18,56,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
<Button IsEnabled="False" Content="Button" Height="23" HorizontalAlignment="Left" Margin="18,112,0,0" Name="Button2" VerticalAlignment="Top" Width="75" />
<Button IsEnabled="False" Content="Button" Height="23" HorizontalAlignment="Left" Margin="18,165,0,0" Name="Button3" VerticalAlignment="Top" Width="75" />
</Grid>
<Frame Source="Page1.xaml" Height="250" HorizontalAlignment="Left" Margin="114,38,0,0" Name="Frame1" VerticalAlignment="Top" Width="300" />
</Grid>
</Window>
MainWindow를
된 .vbPublic Class MainWindow
End Class
페이지 1 .Xaml
<Page x:Class="Page1"
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"
d:DesignHeight="250" d:DesignWidth="300"
Title="Page1">
<Grid x:Name="Page1Grid" Background="Red">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="113,166,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
<TextBlock Height="23" HorizontalAlignment="Left" Margin="14,12,0,0" Name="Page1TxtBlock" Text="Page1" VerticalAlignment="Top" />
</Grid>
1 페이지 된 .vb
,691,363 (210)Class Page1
Dim clicks As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Try
clicks += 1
If clicks >= 10 Then
MessageBox.Show("Window Buttons should be enabled")
clicks = 0
End If
Catch ex As Exception
End Try
End Sub
End Class
후 관련 코드와 XAML을 사용하여 PAGE1에서프레임 사용 페이지를 초기화
전화를. 또한 대신'Window.ShowDialog()'를 사용할 수도 있습니다. –
자식 (페이지)이 프레임을 통과하기 때문에 작동하지 않습니다. –
관련 코드와 XAML을 게시하십시오. 당신의 설명은 상황을 잘 설명하지 못합니다. 부모 창과 자식 창이 있다고 말하면서 질문을 시작하지만, 이제는 자식 창이 아니라 페이지라는 것을 완전히 다른 것으로 말합니다. –