ControlPanelItemCollection no longer in RadGridView?

1 Answer 49 Views
GridView
almostEric
Top achievements
Rank 1
almostEric asked on 19 May 2021, 09:34 AM

I have a template for a customized control panel for my grid (see below).
It has been working fine for over a year, until I did the latest update (2021 R2).
Now I get an error that the CotrolPanelItemCollection is not part of the RadGridView.

Getting really frustrated lately with updates causing more problems than solutions :/
Right now both Blazor and WPF are unusable

Style TargetType="telerik:RadGridView" BasedOn="{StaticResource RadGridViewStyle}">
        <Setter Property="ControlPanelItems">
            <Setter.Value>
                <telerik:ControlPanelItemCollection>
                    <telerik:ControlPanelItem ButtonTooltip="Export To CSV" >
                        <telerik:ControlPanelItem.ButtonContent>
                            <Button Name="exportCSVButton" Width="16" Height="16" FontSize="8">
                                CSV
                            </Button>
                        </telerik:ControlPanelItem.ButtonContent>
                    </telerik:ControlPanelItem>
                    <telerik:ControlPanelItem ButtonTooltip="Export To PDF" >
                        <telerik:ControlPanelItem.ButtonContent>
                            <Button Name="exportPDFButton" Width="16" Height="16" FontSize="10">
                                PDF
                            </Button>
                        </telerik:ControlPanelItem.ButtonContent>
                    </telerik:ControlPanelItem>
                    <telerik:ControlPanelItem ButtonTooltip="Column chooser" >
                        <telerik:ControlPanelItem.ContentTemplate>
                            <DataTemplate>
                                <ListBox ItemsSource="{Binding Columns}"  BorderThickness="0">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <CheckBox Content="{Binding Header, Mode=OneWay}" 
                                                      IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </DataTemplate>
                        </telerik:ControlPanelItem.ContentTemplate>
                    </telerik:ControlPanelItem>
                </telerik:ControlPanelItemCollection>
            </Setter.Value>
        </Setter>

Martin Ivanov
Telerik team
commented on 19 May 2021, 12:38 PM

Hello Eric. The ControlPanelItemCollection is still part of the Telerik.Windows.Controls.GridView assembly. The error probably comes from another place. I've checked this just in case, but I was able to properly build a new project using the Style from your code snippet. This said, can you please check if all Telerik assemblies are having the same version after the upgrade? If this doesn't help I would suggest you to send over a sample project showing the issue, so I can check it out. 
almostEric
Top achievements
Rank 1
commented on 20 May 2021, 06:29 AM

Hi, now it looks like the issue is that there is also a ControlPanelItemCollection in DataCards and WPF is complaining the reference is ambiguous. When I get option to add reference it says there are multiple options (gridview and datacard), but it still doesn't work. Not sure how to fix this (somehow need to specify it is the gridview collection I am targeting). GridView.ControlPanelItemCollection and RadGridView.ControlPanelItemCollection did not work
Martin Ivanov
Telerik team
commented on 20 May 2021, 06:45 AM

That last piece of information you found was important. So, the issue appears if you have both Telerik.Windows.Controls.GridView.dll and Telerik.Windows.Controls.Data.dll referenced in the project. Is this right?

The RadCardView control is mimicking the control panel feature of RadGridView which means that it uses very similar API. However, because the cardview is defined in a different assembly parts of the API had to be duplicated. This is the case with the ControlPanelItemCollection. Because both ControlPanelItemCollection classes are mapped to the "telerik" schema, the error appears.

To resolve this, you can use an additional namespace (in XAML) that points to the Telerik.Windows.Controls.GridView namespace. For example:

 xmlns:gridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"

Then you can use it like so:

<gridView:ControlPanelItemCollection>

 

almostEric
Top achievements
Rank 1
commented on 20 May 2021, 06:52 AM

yep, right after I submitted this, I added the second namespace reference. Not sure why I had to do it manually, might be a resharper issue.
Martin Ivanov
Telerik team
commented on 20 May 2021, 08:01 AM

I use the Visual Studio 2019's built-in tool that automatically extracts the namespace (by pressing Ctrl+. on the corresponding element in XAML), however this doesn't work if the element class is used in a Styles. I will guess that there is some kind of limitation in the Visual Studio's designer.
Heiko
Top achievements
Rank 1
Veteran
commented on 05 Jun 2021, 07:45 PM | edited

Hello Martin, I consider this a serious BUG!! I recently updated from 2020.R3 to 2021.R2 and I have the same problem. The App is compiling but throws an error: ArgumentException: The value "Telerik.Windows.Controls.GridView.ControlPanelItem" is not of type "Telerik.Windows.Controls.Data.CardView.IControlPanelItem" and cannot be used in this generic collection. If Telerik really just duplicated the API, that's bad engineering! Btw where can I find the documentation that this has changed?? At least this information should be added to the documentation (https://docs.telerik.com/devtools/wpf/controls/radgridview/features/overview-controlpanel).
Martin Ivanov
Telerik team
commented on 07 Jun 2021, 06:52 AM

Thank you for the feedback Heiko. We will update the documentation accordingly. As for the issue at hand, changing the API at this point it will be a breaking change that we prefer to avoid. Anyway, I agree that the naming could be a bit more specific for the CardView.

Heiko
Top achievements
Rank 1
Veteran
commented on 07 Jun 2021, 03:55 PM

Hello Martin, in my opinion the breaking change happened before by duplicating the ControlPanelItemCollection. As far as I understand a breaking change is something which stops the code from compiling or running. Well, after I updated to 2021.R2 the code stopped running. Isn't that a breaking change? - Thanks for updating the documentation anyway.
Martin Ivanov
Telerik team
commented on 08 Jun 2021, 11:04 AM

We've further discussed this and we've taken the decision to improve this behavior. You can find it logged in the feedback portal.
Heiko
Top achievements
Rank 1
Veteran
commented on 09 Jun 2021, 12:32 PM

Hello Martin! This is good news, thanks a lot for logging this in the feedback portal!

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 08 Jun 2021, 11:03 AM

Hello guys,

We've discussed this internally and we've decided to improve the current setup. This is why I logged an item in the Telerik feedback portal where you can track its status.

For anyone else that steps on this issue, you can work it around by using the concrete namespace where the control panel classes are found, instead of the "telerik" schema.

 xmlns:gridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"

 <gridView:ControlPanelItemCollection>

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
almostEric
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or