private void OnFrameChanged(Frame oldFrame, Frame newFrame) { if (newFrame != null) { newFrame.RegisterEventSink(this); } UpdateCommandStates(); }