Hi,
we have bin using caliburn with your control in th past and where facing some isues.
Currently we are migrating our project from caliburn to caliburn micro.We are facing now more issues.
1. The attaching of actions in the XamRibbon.ApplicationMenu is not working with out of the box caliburn. The buttontool actions work inside the ribbon tab but not in the XamRibbon.ApplicationMenu.You see different kind of Approach to get the action attached in below example. All out of the box with caliburn micro not working.We have statred to create out own custimization to set the datacontex correclty.What is the right solution to fix this issue?
2. Adding button to the QAT will trigger the event twice.How to fix that? The button is cloned and the action is now triggered twice
Here the example of the XAML.
<Window x:Class="CaliburnMicroWPFTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igRibbon="clr-namespace:Infragistics.Windows.Ribbon;assembly=InfragisticsWPF4.Ribbon.v11.2" xmlns:cal="clr-namespace:CaliburnMicroWPFTest.Framework" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:local="clr-namespace:CaliburnMicroWPFTest" Title="Window1" Height="300" Width="600"> <Window.Resources> <local:Window1Model x:Key="Window1Model" /> </Window.Resources> <Grid Background="White"> <igRibbon:RibbonWindowContentHost > <igRibbon:RibbonWindowContentHost.Ribbon > <igRibbon:XamRibbon> <igRibbon:XamRibbon.ApplicationMenu > <igRibbon:ApplicationMenu UseLargeImages="True" RecentItemsHeader="Test" Caption="Start" cal:Action.Target="{Binding}"> <igRibbon:ButtonTool Caption="Button With Customized Attach Method ( Ctrl + M )"> <i:Interaction.Triggers> <local:MethodTrigger AttachedEvents="[Event Click] = [Action RunMethod()]" Key="M" Modifier="Control" MethodName="RunMethod"/> </i:Interaction.Triggers> </igRibbon:ButtonTool> <igRibbon:ButtonTool Caption="Button With Interaction.Triggers Attach Method"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <cal:ActionMessage MethodName="RunMethod()" /> </i:EventTrigger> </i:Interaction.Triggers> </igRibbon:ButtonTool> <igRibbon:ButtonTool Caption="Button With Caliburn Micro Attach Method" cal:Message.Attach="[Event Click] = [Action RunMethod()]" /> </igRibbon:ApplicationMenu> </igRibbon:XamRibbon.ApplicationMenu> <igRibbon:XamRibbon.QuickAccessToolbar> <igRibbon:QuickAccessToolbar> <igRibbon:QatPlaceholderTool TargetId="JumpTo" /> </igRibbon:QuickAccessToolbar> </igRibbon:XamRibbon.QuickAccessToolbar> <igRibbon:RibbonTabItem Header="Ribbon Tab Item" cal:Action.Target="{Binding}"> <igRibbon:RibbonGroup Caption="Ribbon Group"> <igRibbon:ButtonTool igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge" Grid.RowSpan="2" Id="JumpTo" IsQatCommonTool="True" Content="Button With Caliburn Micro Attach Method" MinWidth="50" HorizontalContentAlignment="Center" Margin="5,0,0,0" cal:Message.Attach="[Event Click] = [Action RunMethod()]" > </igRibbon:ButtonTool> </igRibbon:RibbonGroup> </igRibbon:RibbonTabItem> </igRibbon:XamRibbon> </igRibbon:RibbonWindowContentHost.Ribbon> </igRibbon:RibbonWindowContentHost> </Grid> </Window>
I also have attached the project as zip.
Regards
Peter
Hello Peter,
Thank you for the sample, I highly appreciate that you provided this to us. I have been looking into it, still the program logic that you use is too complicated and complex for me to follow. Since we haven’t fully test the behavior of the control when it is bound to caliburn micro, I can’t be sure if the issues you are referring are caused by the XamRibbon control itself. Is it possible for you to simplify the sample you sent, so I can continue my investigation on this matter?
Thanks in advance.
Hi Elena,
Well using MVVM should make things less complicated :-)
I think i can not more simplify the application as it basically shows only the issues an not more.
Well as described we do have 2 issues.
1) issue related to the application menu the button in the ribbon group shows that the issue is not caliburn. If the button control is inside the ribbon button group it is working. If i put the button tool inside a ContentControl the action is attached. Could be related to that fact that buttontool is not a ContentControl.
See also discussion http://caliburnmicro.codeplex.com/discussions/246017
2) that the event in QAT is triggered twice
When you use the QAT with XamRibbon the original button is *copied* including it's event handlers into the QAT version. This causes the event handlers to be wired and the interaction trigger to be applied again which causes all the events to be wired again.
Thanks Peter