フレームを動的に作成し、スタックパネルの子に追加します。マウスイベントは正常に機能していましたが、何らかの理由で停止しました。どんな助けもありがとうございます。私はそれらを作成ところです:WPFフレームStackPanelの内側でイベントが発生しない
Frame newFrame = new Frame();
Page current = Globals.Static.GetCurrentProcess() as Page;
current.Width = 1199; // Doing this here forces the scaletransform to shrink entire app -- must be done on the page
newFrame.Content = current;
newFrame.Width = 384;
newFrame.Height = 288; // Doing this here will limit the shrunk app's height -- must be done on the frame
newFrame.MouseDoubleClick += new MouseButtonEventHandler(newFrame_MouseDoubleClick);
newFrame.Name = current.Title + "_Frame";
this.stackRunning.Children.Add(newFrame);
Separator newSeparator = new Separator();
newSeparator.Name = current.Title + "_Separator";
this.stackRunning.Children.Add(newSeparator);
stackRunning
は、メインウィンドウに空StackPanel
です。イベントハンドラでは、変数を作成して停止します。それは決して発火しません。
私は、MouseDown、PreviewMouseDown&PreviewMouseDoubleClickを試しました...それらのどれも起動しません。それは奇妙です...これは動作していて、突然停止しました。 –