Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
141
using caliburn micro with infragists WPF controls
posted

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

CaliburnMicroWPFTest.zip
Parents
No Data
Reply
  • 17559
    posted

    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.

Children