keydown no longer working after adding control to a wpf page

  • Thread starter Thread starter Adrian Radu
  • Start date Start date
A

Adrian Radu

Guest
I have a strange problem, I had a WPF (with C# code behind) page with some buttons and some keydown events. Recently I've added a ribbon control to group the buttons and the keydown events aren't working any more. The strangest thing is that if I add back any of the old buttons (outside of the ribbon) and click on it then the keydown events start working.

d:DesignHeight="550" d:DesignWidth="800"
Title="SceneEditor" KeyDown="MainViewport_KeyDown" PreviewKeyDown="Window_PreviewKeyDown"
ShowsNavigationUI="False" >


private void MainViewport_KeyDown(object sender, KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine("KeyDown");
// ESC deselects all
if (e.Key == Key.Escape)
{
for (var i = 0; i < spheres.Count; i++)
{
spheres.
Material = material;
spheres.
Radius = originalRadius;
}

for (var i = 0; i < lines.Count; i++)
{
lines.
LineColor = originalLineColor;
}

DataToolTipBorder.Visibility = Visibility.Collapsed;
this.DataContext = null;
}


Thanks,

Continue reading...
 
Back
Top