I Try to make a Quickaccestoolbar. I ahve the following code :
ButtonTool
btnToolCopy = new ButtonTool();
btnToolCopy.Id =
"copyTool";
// Adding ButtonTool to the QAT
qatToolCopy.TargetId =
// btnToolCopy.Id
qatToolCopy.TargetType =
QatPlaceholderToolType.Tool;
this.xamRibbon1.QuickAccessToolbar.Items.Add(qatToolCopy);
But i get a exception error :
An item with the specified TargetId 'copyTool' being added to the QuickAccessToolbar is not registered with the associated XamRibbon.
Thank you for help CaisseOdev
Hi Caisse,
The reason for the error is the ButtonTool must be added to the XamRibbon before it can be added to the QAT. To add the ButtonTool to the XamRibbon you'll need to add it to a XamRibbon group. This link demonstrates how you can do this: http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=xamRibbon_Add_Tools_to_a_Ribbon_Group.html
After the ButtonTool has been added to the group, you can add it to the QAT.http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=xamRibbon_Add_a_Tool_or_RibbonGroup_to_the_Quick_Access_Toolbar.html
Let me know if you have any questions on this.
Thank you for the answer , but I Have always the following error :
An item with the specified TargetId 'btnBold' being added to the QuickAccessToolbar is not registered with the associated XamRibbon.
Here is my code :
RibbonGroup
RibbonGroup group = new RibbonGroup();
group.caption = "Font";
group.id = "grpfont";
buttonTool btnTool = new ButtonTool();
btnTool.Caption = "Bold";
btnTool.Id = "btnBold";
group.Items.Add(btnTool);
QatPlaceholderTool btnBoldPH = new QatPlaceholderTool("btnBold"
);
//If you need to add a RibbonGroup to the QAT, you have to set the TargetType to RibbonGroup
QatPlaceholderTool tab1_group1PH = new QatPlaceholderTool("grpFont", QatPlaceholderToolType
.RibbonGroup);
//Replace xamRibbon1 with the instance variable of your xamRibbon
this.xamRibbon1.QuickAccessToolBar.Items.Add(btnBoldPH);
this.xamRibbon1.QuickAccessToolbar.Items.Add(tab1_group1PH);
WHERE IS ERROR ?
thank you CaisseOdev