Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Adding Checkbox in Record Selectors fails
posted

Hi,

Does anyone know how to solve the following problem ?

I have a grid which datasource is filled based on a stored procedure. In the xaml I have added the styles for the checkbox for each record and for the header. 

The problem is that if I click the header checkbox, this gets selected but all the records remain unchecked. I have no idea how I can change this such that all the records are checked/unchecked too. Probably there is a simple trick, can someone help me ?

 

C# code:

xamMainGrid.DataSource = MyLinqConn.loadMainGridOverview(strcomboValuationDate, decThreshold, strActiveFlag);

List<pAppDealPriceOverviewResult> loadMainGridOverview

XaML code:

<!-- This Style puts a CheckBox into the record selectors. -->
                                <Style BasedOn="{x:Null}" TargetType="{x:Type igDP:RecordSelector}">
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type igDP:RecordSelector}">
                                                <CheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=DataItem.IsChecked, Mode=TwoWay}" VerticalAlignment="Center" Checked="fRecordChecked" Unchecked="fRecordUnChecked" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                                <!-- This Style puts a CheckBox into the header area above the record selectors. -->
                                <Style TargetType="{x:Type igDP:HeaderPrefixArea}" BasedOn="{x:Null}">
                                <Setter Property="Visibility" Value="Visible" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type igDP:HeaderPrefixArea}">
                                                <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=DataPresenter.DataContext.AllMembersAreChecked, Mode=TwoWay}" Checked="fAddAllRecordsToCheckList" Unchecked="fRemoveAllRecordsFromCheckList" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    You would have to provide manual code for checking / unchecking all of the records in the Checked/Unchecked events of the CheckBox. I can see, that you have bound the value of the CheckBox to the corresponding DataItem's IsChecked property. In the Checked/UnChecked events, you need to iterate thorough the record that you need to check or uncheck and set their DataItem.IsChecked properties to true or false respectively.

Children