Hi,
I always get a KeyNotFoundException when I click on a RadioTool in my XamWebRibbon
ExceptionStackTrace:
at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Infragistics.Silverlight.Controls.RadioButtonTool.b(DependencyObject A_0, DependencyPropertyChangedEventArgs A_1) at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue) at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Infragistics.Silverlight.Controls.RadioButtonTool.set_IsChecked(Boolean value) at Infragistics.Silverlight.Controls.RadioButtonToolControl.OnToolMouseLeftButtonUp() at Infragistics.Silverlight.Controls.RibbonToolControl.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
I build the Ribbon in Codebehind
my Code:
var tab = new XamWebRibbonTabItem();tab.Name = "TestTab";tab.Header = "TestTab";_Ribbon.Tabs.Add(tab);
var group = new XamWebRibbonGroup();group.Id = "TestGroup";group.Caption = "TestGroup";tab.Groups.Add(group);
var menuTool = new MenuTool();menuTool.IsQatCommonTool = true;menuTool.Id = "TestMenuTool";menuTool.Caption = "Filtering";menuTool.MaximumSize = RibbonToolSizingMode.ImageAndTextLarge;group.Tools.Add(menuTool);
var radio1 = new RadioButtonTool();radio1.Id = "FILTER_TOP";radio1.GroupName = "FilterGroup";radio1.Caption = "Filter Row Top";radio1.IsChecked = true;radio1.Checked += radio1_Checked;menuTool.Items.Add(radio1);
var radio2 = new RadioButtonTool();radio2.Id = "FILTER_BOTTOM";radio2.GroupName = "FilterGroup";radio2.Caption = "Filter Row Bottom";radio2.IsChecked = false;radio2.Checked += radio1_Checked;menuTool.Items.Add(radio2);
var radio3 = new RadioButtonTool();radio3.Id = "FILTER_MENU";radio3.GroupName = "FilterGroup";radio3.Caption = "Filter Menu";radio3.IsChecked = false;radio3.Checked += radio1_Checked; menuTool.Items.Add(radio3);
var radio4 = new RadioButtonTool();radio4.Id = "DISABLE_FILTER";radio4.GroupName = "FilterGroup";radio4.Caption = "Disable Filter";radio4.IsChecked = false;radio4.Checked += radio1_Checked;menuTool.Items.Add(radio4);
Hope you can help me finding the problem with this code.
Thanks alot.
Enrico
cool...your suggestion does work.
Thanks alot for your support Georgi.
Hi Enrico,
This is definitely a bug in the control. I'll make sure it's fixed for the next service release.
As a workaround you could just move the row that adds the group to the tab at the end of your code. So, just move this line in your code: tab.Groups.Add(group); to the end of your snippet.
Thanks for reporting that!