You need to check some other item for each key to see which function to perform. As it stands your cases each perform the same function always. You need something like:
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (inTreeView)
{
switch (e.Key)
{
}
}
else
{
switch (e.Key)
{
}
}
}