private void btnApply_Click(object sender, RoutedEventArgs e) {
MainForm.TheRibbon.ClearQuickAccessToolBar();
Dictionary<string, IRibbonControl> items = (from Tab in MainForm.TheRibbon.Tabs
from Group in Tab.Groups
from Item in Group.Items.OfType<IRibbonControl>()
select Item).
ToDictionary(_ => (_ as FrameworkElement).Name, _ => _);
foreach (string item in from Item in this.QATControls.Items.Cast<RibbonItemListDisplay>() select Item.ItemName) {
IRibbonControl ctrl;
if (items.TryGetValue(item, out ctrl)) {
MainForm.TheRibbon.AddToQuickAccessToolBar(ctrl as UIElement);
}
}
}