我在製作一個WPF應用程序。我有一個靜態項目的數據網格。現在我想單擊一行顯示一個新窗口。如果點擊datagrid中的行然後打開新窗口
我在做什麼錯?
這是我的第二個窗口,我想打開點擊時:WindowMail.cs
using System;
namespace Phish_Finder
{
internal class WindowMail
{
internal void Show()
{
WindowMail wm = new WindowMail();
wm.Show();
}
}
}
這是我的第一個窗口Mainwindow.xaml.cs
private void DataGrid_MouseDoubleClick(object sender, RoutedEventArgs e)
{
var currentRowIndex = URLGRID.Items.IndexOf(URLGRID.CurrentItem);
{
if (URLGRID.CurrentItem != null)
{
WindowMail wm = new WindowMail();
wm.Show();
}
}
}
的方法,這是我的DataGrid
DataGrid x:Name="URLGRID" HorizontalAlignment="Left" Height="400"
Margin="60,300,0,0" VerticalAlignment="Top" Width="1350" Loaded="DataGrid_Loaded"
MouseDoubleClick="DataGrid_MouseDoubleClick"
我是WPF新手,我想我正在混淆我在哪裏應該放置方法。但我不確定。
請問你的代碼的工作? –
您在show函數中調用show函數,看起來像是一個無限循環 – Schuere