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 란 무엇입니까? 다른 반은 어디 있니? 무슨 실수있어? –
조금 더 자세한 정보가 필요합니다. 어떤 종류의 오류가 있습니까? 그리고 axFlash는 어떤 유형의 객체입니까? – sbenderli
axFlash는 플래시 객체입니다. 이 오류가 나타납니다. "오류 \t 1 'axFlash'라는 이름이 현재 컨텍스트에 없습니다." – Paul