Hi,
I created a "FlyoutButtonTool" by creating a class that inherits from the Ribbon.ButtonTool and adds a System.Windows.Controls.Primitives.Popup piece whose PlacementTarget is the ButtonTool. However, when I do this, I cannot place the RibbonGroup in the QAT. It does not popout from the Button like other controls do.
What am I doing wrong? Are we not allowed to have custom controls in the RibbonGroup and still have the RibbonGroup appear in the QAT? Or does it have to do with decorating the ButtonTool with a Popup specifically?
Any pointers appreciated.
KZ
When you say that you cannot place the RibbonGroup in the qat, do you mean that the menu item when you right click on the ribbon group caption is disabled or that you get some sort of error when you attempt to add it to the qat? If you get an error, what is the exception and callstack?
Sorry I wasn't clear before. If I right-click on the Ribbon Group, it allows me to select the "Add to QAT" option. The button appears in the QAT with my RibbonGroup.SmallImage. However, clicking on the button does nothing. The button appears in pressed mode, but the RibbonGroup does not get rendered. No exception happens either (at least none that I have caught). When I try to add one of my FlyoutButtonTools to the QAT, then I get this exception: (hopefully related to my current problem).
System.ArgumentException was unhandled Message="Object of type 'System.Windows.Markup.NullExtension' cannot be converted to type 'System.String'." Source="System" StackTrace: at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) at Infragistics.Windows.Ribbon.Internal.RibbonToolProxy.a(Boolean A_0, MarkupObject A_1, IServiceProvider A_2, a A_3, IList`1 A_4, Dictionary`2 A_5) at Infragistics.Windows.Ribbon.Internal.RibbonToolProxy.a(Object A_0, Boolean A_1, a A_2, IList`1 A_3) at Infragistics.Windows.Ribbon.Internal.RibbonToolProxy`1.Clone(T sourceTool) at Infragistics.Windows.Ribbon.Internal.RibbonToolProxy`1.Clone(FrameworkElement sourceTool) at Infragistics.Windows.Ribbon.QatPlaceholderTool.a() at Infragistics.Windows.Ribbon.QatPlaceholderTool.b() at Infragistics.Windows.Ribbon.QatPlaceholderTool.OnVisualParentChanged(DependencyObject oldParent) at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent) at System.Windows.Media.Visual.AddVisualChild(Visual child) at System.Windows.Media.VisualCollection.ConnectChild(Int32 index, Visual value) at System.Windows.Media.VisualCollection.Add(Visual visual) at System.Windows.Controls.UIElementCollection.AddInternal(UIElement element) at System.Windows.Controls.UIElementCollection.Add(UIElement element) at Infragistics.Windows.Ribbon.QuickAccessToolbarPanel.a() at Infragistics.Windows.Ribbon.QuickAccessToolbarPanel.a(Object A_0, ItemsChangedEventArgs A_1) at System.Windows.Controls.ItemContainerGenerator.OnItemAdded(Object item, Int32 index) at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) at System.Windows.Controls.ItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list) at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args) at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list) at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args) at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) at MS.Internal.Controls.InnerItemCollectionView.Add(Object item) at System.Windows.Controls.ItemCollection.Add(Object newItem) at Infragistics.Windows.Ribbon.XamRibbon.c(FrameworkElement A_0) at Infragistics.Windows.Ribbon.XamRibbon.a(Object A_0, ExecutedRoutedEventArgs A_1) at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e) at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding) at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute) at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute) at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e) at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e) at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated) at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated) at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at RibbonTester.App.Main() in C:\Projects\IDD\PlayArea\RibbonTester\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[ args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Based on the callstack, it looks like this was just a problem during our cloning process - specifically with use of an {x:Null}. That has changed quite a bit since the initial beta release and should work fine in the release. In the meantime, if you don't absolutely need the x:Null, you could remove it.