Implementing the double-click event on Silverlight 4 Datagrid

Posted by Mohammed Mudassir Azeemi on Stack Overflow See other posts from Stack Overflow or by Mohammed Mudassir Azeemi
Published on 2010-03-13T01:47:14Z Indexed on 2010/03/13 1:57 UTC
Read the original article Hit count: 1393

Filed under:

Any good soul have an example of implementing the "Command Pattern" introduced by Prism on "Double-click event" of Silverlight 4.0 DataGrid.

I did try the following:

                <data:DataGrid x:Name="dgUserRoles" 

AutoGenerateColumns="False" Margin="0" Grid.Row="0" ItemsSource="{Binding Path=SelectedUser.UserRoles}" IsReadOnly="False"

                    >
                    <data:DataGrid.Columns>
                        <data:DataGridTemplateColumn Header=" ">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Width="20" Height="20" Click="Button_Click"
                                                    Command="{Binding EditRoleClickedCommand}" 
                                                    CommandParameter="{Binding SelectedRole}" >
                                    </Button>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>
                        <data:DataGridTextColumn Header="Role Name" Binding="{Binding RoleName}"   />
                        <data:DataGridTextColumn Header="Role Code" Binding="{Binding UserroleCode}" IsReadOnly="True"/>
                        <data:DataGridCheckBoxColumn Header="UDFM Managed" Binding="{Binding RoleIsManaged}" IsReadOnly="True" />
                        <data:DataGridCheckBoxColumn Header="UDFM Role Assigned" Binding="{Binding UserroleIsUdfmRoleAssignment}" IsReadOnly="True" />
                        <data:DataGridTextColumn Header="Source User" Binding="{Binding SourceUser}" IsReadOnly="True" />
                    </data:DataGrid.Columns>
                </data:DataGrid>

As you see I did try to hook up the Command there and it is not firing the event in my View Model.

Looking for a good alternative.

© Stack Overflow or respective owner

Related posts about silverlight-4.0