lundi 27 février 2017

Listview load checked checkboxes when click edit button wpf

xml code

<ListView Name="lstvPermissions" BorderBrush="White" BorderThickness="0.4" Height="190" MinHeight="190" MaxHeight="325" Margin="10">
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel Width="{Binding (FrameworkElement.ActualWidth), 
        RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
        ItemWidth="{Binding (ListView.View).ItemWidth, 
        RelativeSource={RelativeSource AncestorType=ListView}}"
        MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
        ItemHeight="{Binding (ListView.View).ItemHeight, 
        RelativeSource={RelativeSource AncestorType=ListView}}" />
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                        <ListView.View>
                            <GridView>
                                <GridViewColumn>
                                    <GridViewColumnHeader>
                                        <TextBlock Text="Permissions"/>
                                    </GridViewColumnHeader>
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox Content="{Binding prsnRolDTitle}" IsChecked="{Binding Mode=TwoWay, RelativeSource={RelativeSource AncestorType=ListViewItem},Path=IsSelected}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>

cs code

 lstvPermissions.ItemsSource = AS.Tbl_PersonRolesDetail.ToList();

my above code working fine and look like this:

selected permissions insert database and show these roles in datagrid, now when I click datagrid edit button title field and description field filled but I don't no how I load checked checkboxes to see previously I assigned permissions. Thanx in advance for any help.




Aucun commentaire:

Enregistrer un commentaire