This is a migrated thread and some comments may be shown as answers.

Need to click twice on CheckBoxes in Hierarchical Child Template - help please!

0 Answers 27 Views
GridView
This is a migrated thread and some comments may be shown as answers.
b
Top achievements
Rank 1
b asked on 30 Oct 2012, 03:36 PM
Hi,

I have a 2 level hierarchy for a data source.  The 1st level items are being rendered as rows in the GridView, as a CheckBox (we'll call this CBL1 for CheckBox level 1) and a TextBlock.

The 2nd level items are being rendered in a WrapPanel (which is set as the ItemsControl in the HierarchyChildTemplate's DataTemplate).  The ItemTemplate is a StackPanel containing a CheckBox (we'll call this CBL2 for CheckBox level 2) and a TextBlock.

I'm having a very strange problem:  After the GridView is generated, nothing happens the 1st time I click on any CBL2 and I have to click a second time to get it to be checked/unchecked.  Subsequent first clicks on any CBL2, even of a different parent, work perfectly fine, it's always the 1st one after the GridView is generated that doesn't seem to register a click even.  I'm not having this problem with any CBL1, it's just CBL2.

I'd greatly appreciate any help with this issue.

Here is my GridView definition:
<telerik:RadGridView x:Name="MainGrid"
    RowIndicatorVisibility="Collapsed" IsReadOnly="False" AutoGenerateColumns="False"
    CanUserFreezeColumns="False" ShowGroupPanel="False" CanUserResizeColumns="False"
    CanUserSortColumns="False" IsFilteringAllowed="False"
    RowLoaded="MainGrid_RowLoaded"
    HorizontalAlignment="Stretch"
    Visibility="Collapsed" ShowColumnHeaders="False" ColumnBackground="White" Background="White"
    RowStyle="{StaticResource MyRowStyle}" BorderThickness="0"
    >
<telerik:RadGridView.ChildTableDefinitions>
    <telerik:GridViewTableDefinition>
    </telerik:GridViewTableDefinition>
</telerik:RadGridView.ChildTableDefinitions>
<telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn Header="{Binding Path=TextResourcesInput, Converter={StaticResource TextResourceConverter}, ConverterParameter=lblSelected}" CellStyle="{StaticResource MyCellStyle}" IsReadOnly="True">
        <telerik:GridViewDataColumn.CellTemplate>
            <DataTemplate>
                <CheckBox Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" VerticalAlignment="Top"/>
            </DataTemplate>
        </telerik:GridViewDataColumn.CellTemplate>
    </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn
        Header="{Binding Path=TextResourcesInput, Converter={StaticResource TextResourceConverter}, ConverterParameter=lblReason}" Width="*" CellStyle="{StaticResource MyCellStyle}"
        TextWrapping="Wrap" TextTrimming="WordEllipsis" IsReadOnly="True">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Left" Width="300" ToolTipService.ToolTip="{Binding Name}" TextTrimming="WordEllipsis" TextWrapping="Wrap"/>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
 
<telerik:RadGridView.HierarchyChildTemplate>
    <DataTemplate>
        <Grid Margin="0" Background="White">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
 
            <StackPanel Orientation="Vertical" Grid.Column="1" Background="White">
                <telerik:ItemsControl x:Name="wrappedItems" Grid.Column="1" Background="White"
                ItemsPanel="{StaticResource wrapItemsPanel}"
                ItemsSource="{Binding Entities}">
                    <telerik:ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="5,2" Background="White">
                                <CheckBox Click="CheckBox_Click" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Loaded="CheckBox_Loaded" VerticalAlignment="Top"/>
                                <TextBlock Text="{Binding Name}" Width="150" ToolTipService.ToolTip="{Binding Name}" TextTrimming="WordEllipsis" TextWrapping="Wrap"/>
                            </StackPanel>
                        </DataTemplate>
                    </telerik:ItemsControl.ItemTemplate>
                </telerik:ItemsControl>
                <TextBox HorizontalAlignment="Left" BorderBrush="#FFECE2D2" Width="250" Margin="3" TextChanged="TextBox_TextChanged" Loaded="TextBox_Loaded" />
            </StackPanel>
 
        </Grid>
    </DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
 
</telerik:RadGridView>


Here is my ItemsControl template:
<ItemsPanelTemplate x:Key="wrapItemsPanel">
    <!--Here is the wrap panel that will be used:-->
    <telerik:RadWrapPanel IsAnimated="False" MaxWidth="600"/>
</ItemsPanelTemplate>

No answers yet. Maybe you can help?

Tags
GridView
Asked by
b
Top achievements
Rank 1
Share this question
or