This project has moved. For the latest updates, please go here.

Issue in trigger the Command from Infragistics.Silverlight.Controls ButtonTool ,not able to execute the command using with EventToCommand

Feb 7, 2011 at 8:28 AM

Hi All

i am using MVVM Light frame work to implement the MVVM Model in Silverlight application.

I am facing one issue in trigger the Command from Infragistics.Silverlight.Controls ButtonTool , that is not able to execute the command using with EventToCommand, please guide me how can I do this.

Namespace binding:

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 

   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

   xmlns:commands="clr-namespace:Bixi.Atlas.Client.UI.Silverlight.Commands;assembly=Bixi.Atlas.Client.UI.Silverlight"

   mc:Ignorable="d"

           xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"

           xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

           xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"

           DataContext="{Binding CostCentreVM, Source={StaticResource Locator}}"

   d:DesignHeight="400" d:DesignWidth="800"

           xmlns:igRibbon="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebRibbon.v10.1">

 

ButtonTool binding

<igRibbon:ButtonTool IsEnabled="True" Caption="Delete" MaximumSize="ImageAndTextLarge" LargeImage="/Bixi.Atlas.Client.UI.Silverlight;component/Image/NavigationData/delete.png">

                       <i:Interaction.Triggers>

                           <i:EventTrigger EventName="Click">

                               <cmd:EventToCommand Command="{Binding DeleteCostCentreCommand}"/>

                           </i:EventTrigger>

                       </i:Interaction.Triggers>

                      

 

                   </igRibbon:ButtonTool>

Thanks

Ritesh

Coordinator
Feb 7, 2011 at 9:56 AM

Hi,

Unfortunately, there is nothing I can do here. The issue is that the Infragistics control (which I cannot change) fails to raise the event in a way that is caught by the EventTrigger (which is developed by Microsoft, and which I cannot change).

I recommend calling Infragistics support and reporting the issue to them. If I had to guess, I'd say that their event is not routed properly.

Cheers,

Laurent

Jul 5, 2011 at 12:08 PM
Edited Jul 12, 2011 at 8:03 AM

I'm not sure if the problem is in the Infragistics controls - if you try to play a sound in the trigger it works ok 

="/dynamic.mp3"/> 

<ei:PlaySoundAction Source

So there must be another issue not connected to firing the EventTrigger itself.

Edit: The problem is that the ButtonTool is not a Framework Element (not in the visual tree) and its DataContext property(VM) is null. A workaround is to create a resource that will hold a reference to the instance of the VM and use this static resource as a Source of the Binding done in the ButtonTool. 

Jul 26, 2011 at 8:14 AM
Edited Jul 26, 2011 at 8:27 AM

Here are the 2 possible solutions:

The one that I suggested in the previous post -  http://blogs.infragistics.com/blogs/ivo_evtimov/archive/2011/07/26/using-xamribbon-buttontool-in-mvvm-applications.aspx 

 Using commanding - http://blogs.infragistics.com/blogs/devin_rader/archive/2011/07/12/extending-a-xamribbon-buttontool-to-execute-icommands.aspx