private void TrackMenuItem_Click(object sender, RoutedEventArgs e) { var menu = TracksMenus.FirstOrDefault(kvp => kvp.Value.MenuFlyout.Items.Contains(sender)); if (!menu.Equals(default(KeyValuePair <TrackType, TracksMenu>))) { CheckMenuItem(menu.Value, sender); MediaElement.SetTrack(menu.Key, (int?)((MenuFlyoutItemBase)sender).Tag); } }
private void TrackMenuItem_Click(object sender, RoutedEventArgs e) { var menu = TracksMenus.FirstOrDefault(kvp => kvp.Value.MenuFlyout.Items.Contains(sender)); if (!menu.Equals(default(KeyValuePair <TrackType, TracksMenu>))) { foreach (var item in menu.Value.MenuFlyout.Items) { if (item is ToggleMenuFlyoutItem) { ((ToggleMenuFlyoutItem)item).IsChecked = (item == sender); } } MediaElement.SetTrack(menu.Key, (int?)((MenuFlyoutItemBase)sender).Tag); } }