public void UpdateHotkeys() { HotKey irHotKey = HotKey.FromVirtual(new Keys[] { (Keys)Convert.ToInt32(api.GetProperty("DVRHKey0")), (Keys)Convert.ToInt32(api.GetProperty("DVRHKey1")), (Keys)Convert.ToInt32(api.GetProperty("DVRHKey2")), (Keys)Convert.ToInt32(api.GetProperty("DVRHKey3")) }); HotKey mrHotKey = HotKey.FromVirtual(new Keys[] { (Keys)Convert.ToInt32(api.GetProperty("ManualHKey0")), (Keys)Convert.ToInt32(api.GetProperty("ManualHKey1")), (Keys)Convert.ToInt32(api.GetProperty("ManualHKey2")), (Keys)Convert.ToInt32(api.GetProperty("ManualHKey3")) }); foreach (FrameworkElement mi in tb.ContextMenu.Items.SourceCollection) { if (mi.Name == "irHotKey") { ((MenuItem)mi).InputGestureText = irHotKey.ToString(); } if (mi.Name == "mrHotKey") { ((MenuItem)mi).InputGestureText = mrHotKey.ToString(); } } }