You must Sign In to post a response.
  • Category: WPF

    Checkbox checked issue in wpf

    hi, all,

    I am working on wpf with entity framework by using stored procedures,
    for binding i am using Results genarated model,
    my entity frame work dynamically giving one model,
    DataAccess.sp_GetRequisitionDetails_Result,
    for biding DataGrid we used above model with ObservableCollection,
    we are binding checkbox for saving multiple records,
    after selecting checkbox in view it is dispalying all the checkbox are ckecked false,
    my code is


    <DataGrid AlternatingRowBackground="#F5F5DC"
    AutoGenerateColumns="False"
    HorizontalAlignment="Stretch" MinHeight="400" Name="dgRequisitions" CanUserAddRows="False" VerticalAlignment="Top"
    ItemsSource="{Binding RequisitionsList, Mode=TwoWay,IsAsync=True}" Grid.Row="3" Grid.ColumnSpan="3" IsReadOnly="True" Style="{DynamicResource DataGridStyle1}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
    <DataGrid.Columns>
    <DataGridTemplateColumn>
    <DataGridTemplateColumn.CellTemplate >
    <DataTemplate >
    <CheckBox Width="40" IsChecked="{Binding Path= IsAuthorized,Mode=TwoWay }"></CheckBox>
    </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>

    in vm
    foreach (var item in RequisitionsList)
    {
    if (Convert.ToBoolean(item.IsAuthorized))
    {


    after slected checkbox also every record is displaying isauthorized false
  • #757808
    Hello Ramana,

    Refer the below links:
    http://stackoverflow.com/questions/15595920/wpf-data-grid-view-default-checkbox-value-get

    http://stackoverflow.com/questions/10208004/datagrid-column-header-should-check-uncheck-checkbox-s-state-depending-upon-wh

    Best example i have ever seen:
    http://www.codeproject.com/Articles/42437/Toggling-the-States-of-all-CheckBoxes-Inside-a-Dat#

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


  • Sign In to post your comments