我在WPF中有兩個頁面。頁面A包含我所有的代碼。頁面B是爲了像一個控制面板,我點擊按鈕來操作窗口A.如何通過WPF/C中的button_click傳遞對象的引用#
我遇到的問題是我想進行從B到A的函數調用,但我得到一個範圍錯誤。
在下面的代碼中,我特別在axFlash對象上得到了錯誤。
namespace GoogleMapsFlashInWpf
{
public partial class ButtonPage : Page
{
public ButtonPage()
{
InitializeComponent();
}
private void ClearMarkersButton(object sender, RoutedEventArgs e)
{
StackTrace asdf = new StackTrace();
Console.WriteLine(asdf.GetFrame(0).GetMethod().Name.ToString() + " called from " + asdf.GetFrame(1).GetMethod().Name.ToString());
XElement call = new XElement("invoke",
new XAttribute("name", "clearMarkers"),
new XAttribute("returntype", "xml"));
try
{
axFlash.CallFunction(call.ToString(SaveOptions.DisableFormatting));
}
catch (Exception error)
{
Console.WriteLine(error.ToString());
}
}//end ClearMarkersButton
}
}
什麼是axFlash?你的其他班級在哪裏?你究竟得到了什麼錯誤? – 2010-07-07 20:39:56
您需要提供更多信息。你得到什麼樣的錯誤? axFlash是什麼類型的對象? – sbenderli 2010-07-07 20:40:50
axFlash是一個flash對象。我得到這個錯誤:「錯誤\t 1名稱'axFlash'在當前上下文中不存在」 – Paul 2010-07-07 20:41:51