我尝试开发WPF页面时出现问题。我有一个窗口与WPF框架,当窗口加载我使用MainFrame.Navigate(新的页面对象)。唯一的问题是我不能按任何按钮或使用文本框。任何想法,我如何解决这个问题?wpf页面不可编辑
这里是我的WPF窗口的代码:
<Window x:Class="ViewLayer.Forms.Win_LoginCloseable"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Win_LoginCloseable" Height="477" Width="501" WindowStyle="None" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="180*" />
<RowDefinition Height="164*" />
<RowDefinition Height="35*" />
</Grid.RowDefinitions>
<Rectangle Grid.RowSpan="3" Name="Rect_Main" />
<TextBlock Grid.Row="2" FontFamily="Calibri" FontSize="17" FontStyle="Italic" Margin="10,0,12,7" Name="tb_remainding" Text="" TextAlignment="Justify" TextWrapping="WrapWithOverflow" Height="28" VerticalAlignment="Bottom" />
<Button Content="Cerrrar" Grid.Row="1" Height="73" HorizontalAlignment="Center" Name="btn_cancel" VerticalAlignment="Bottom" Width="173" Click="btn_cancel_Click" Background="#FFC70000" Margin="114,0,114,5" />
<Frame x:Name="MainFrame" IsHitTestVisible="False" NavigationUIVisibility="Automatic" />
<TextBlock FontFamily="Calibri" FontSize="22" FontWeight="Bold" Foreground="#FF797979" Height="95" Margin="0,0,0,0" Name="textBlock2" Text="Una vez identificado, luego de 90 segundos de inactividad el sistema cerrará su sesión automaticamente" TextAlignment="Center" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="1" HorizontalAlignment="Center" />
<TextBox Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="34,100,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
</Grid>
</Window>
窗口
private Win_LoginCloseable()
{
InitializeComponent();
this.Pages = new List<Page>();
this.Pages.AddRange(new Page[]{
new MagneticCardPage(),
new UserInputPage()
});
}
这里的构造函数时我加载形式:
public void LoadForm(int Index = 0)
{
this.MainFrame.Navigate(this.Pages[Index]);
this.ShowDialog();
}
我再说一遍,在一个页面我有文本框和按钮。但是,当我尝试使用它们或点击我可以。事件没有进入页面。
在此先感谢
你可以在你处理事件的地方显示你的代码吗? – msarchet