MVVM-Light Loaded Evented Executing Twice

Posted by user275561 on Stack Overflow See other posts from Stack Overflow or by user275561
Published on 2010-04-06T22:30:32Z Indexed on 2010/04/06 22:33 UTC
Read the original article Hit count: 284

Filed under:
|

Let me show the code first, The Control

<ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>

   <Controls:MatrixGrid x:Name="matrixGrid">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Loaded">
                            <cmd:EventToCommand   Command="{Binding MatrixLoaded}"
                                                  CommandParameter="{Binding ElementName=matrixGrid}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>


                </Controls:MatrixGrid>

<ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>

In The ViewModel Class I have

public RelayCommand<MatrixGrid> MatrixLoaded { get; private set; }

In The Constructor of the View Model I have

 MatrixLoaded = new RelayCommand<MatrixGrid>(MatrixGridAction);

Now When I put a Breakpoint on the Function MatrixGridAction, The breakpoint is hit twice. Am I doing something wrong or is this a bug?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about mvvm