GroupHeaderTemplate

8 posts, 0 answers
  1. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 09 Jan Link to this post

    Hi,

    I'm trying to use different GroupHeaderTemplates with Converters for the columns in my grid view.  If I apply the template to the entire grid, my converter gets invoked.

               <telerik:RadGridView.GroupHeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Group.Key, Converter={StaticResource IsActiveConverter}}" />
                    </DataTemplate>
                </telerik:RadGridView.GroupHeaderTemplate>

     

    If I apply the GroupHeaderTemplates to GridViewDataColumn, my converter gets called unless the column had a cell template.  My converter gets called for the followiing:

     

                   <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name">

                       <telerik:GridViewDataColumn.GroupHeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Group.Key, Converter={StaticResource IsActiveConverter}}" />

                            </DataTemplate>
                        </telerik:GridViewDataColumn.GroupHeaderTemplate>

                </telerik:GridViewDataColumn>

    My converter (IsActiveConverter) does NOT get called for the following.

                   <telerik:GridViewDataColumn Width="16" SortMemberPath="FontFormat">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <Image x:Name="TypeIcon" Width="12" Height="12" Style="{StaticResource TypeIconStyle}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.GroupHeaderTemplate>
                            <DataTemplate>
                                <Image Source="{Binding Group.Key, Converter={StaticResource IsActiveConverter}}" Height="16" Width="16"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.GroupHeaderTemplate>
                    </telerik:GridViewDataColumn>

     

    What am I doing wrong?  Thanks.

     

        
     

  2. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 09 Jan in reply to gordon Link to this post

    Solved.   I was missing GroupMemberPath on my GridViewDataColumn.
  3. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 09 Jan Link to this post

    I'm still having this issue with one column.  IsActiveConverter.Convert never gets called. 

                   <telerik:GridViewDataColumn Width="16" IsSortable="True" SortMemberPath="IsActive" IsGroupable="True" GroupMemberPath="IsActive">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsActive}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}, AncestorLevel=4}, Path= DataContext.ActivateCommand}" CommandParameter="{Binding}" Template="{StaticResource TwoStateActivationTemplate}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.GroupHeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Group.Key, Converter={StaticResource IsActiveConverter}}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.GroupHeaderTemplate>
                    </telerik:GridViewDataColumn>

  4. Stefan
    Admin
    Stefan avatar
    1023 posts

    Posted 12 Jan Link to this post

    Hi Gordon,

    I tested the behavior of the control and the IValueConverter is triggered as expected on my end. Attached to my reply you can find the sample application I used for testing. Can you please take a look at it? Am I missing something?

    Have a nice weekend, Gordon.

    Regards,
    Stefan
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 16 Jan in reply to Stefan Link to this post

    Hi Stefan,

    Your sample app isn't working for me, namely the grid does not appear on the main window.  I haven't had a chance to debug yet.  Also, the Libs folder is empty, so I just used the version of the dll's I have, C:\Program Files (x86)\Progress\Telerik UI for WPF R3 2017\Binaries\WPF45.  Perhaps this is the problem.

     

  6. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 16 Jan Link to this post

    Hi Stefan,

    I added the wrong Progress dll's.  I've now added to correct ones, and the sample is working, and the converter gets called when I group the Id column.  I'm handling the grouping differently than you are.  I don't have the grouping panel.  Instead I have a combo box that groups by column.  I followed the ListBox - Grouping and Filtering demo, and applied it to a grid view.

  7. gordon
    gordon avatar
    18 posts
    Member since:
    Oct 2015

    Posted 17 Jan in reply to gordon Link to this post

    Hi Stefan,

    I've modified the sample solution you sent me to match my scenario.  The IsActiveConverter is getting called in this sample, but for some reason not in my solution.  I'll have to figure that out.  I'm having an addition problem that is reproducible in my modified solutions.  I'm getting an exception  when I group using the grouping combobox, but not when dragging a column to the group panel.  The exception gets thrown in MyViewModel.GroupData().  Here's the exception message, "Cannot change or check the contents or Current position of CollectionView while Refresh is being deferred."  Any help is appreciated.  Thanks.

    I tried to attach the zipped solution, but your system won't except zip files.  How do I send it to you?

     

  8. Stefan
    Admin
    Stefan avatar
    1023 posts

    Posted 19 Jan Link to this post

    Hello Gordon,

    Thank you for the update.

    I am sorry to hear that you are still experiencing issues regarding the grouping of the control. I am afraid that I cannot pinpoint the cause for this exception based on the provided information. More information regarding it can be found in the CollectionView.DeferRefresh() throws exception StackOverflow thread. Can you please check it out?

    As to attaching archives to a reply, our system does not allow this for forum threads. You can open a new support thread and attach the zip in it.

    Have a nice weekend, Gordon.

    Regards,
    Stefan
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top