XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] x:TypeArguments is not working on Popup

Open uzairali001 opened this issue 4 years ago • 2 comments

Description

I'm trying to return strong type from popup but it's not compiling and showing error Partial declarations of 'ExpenseMiscellaneousSelectionPage' must not specify different base classes.

Also intelliSense is not showing x:TypeArguments in xaml.

ExpenseMiscellaneousSelectionPage.xaml

<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="MyApp.Views.Expense.ExpenseMiscellaneousSelectionPage"
           xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
           xmlns:fa="clr-namespace:MyApp.Helpers.Fonts"
           xmlns:b="clr-namespace:MyApp.Behaviours"
           xmlns:dto="clr-namespace:MyApp.Models.Dtos.Expense"
           x:DataType="dto:MiscellaneousItemDto"
           x:TypeArguments="dto:MiscellaneousItemDto"
           Size="300,400">
   ...
</xct:Popup>

ExpenseMiscellaneousSelectionPage.cs


using MyApp.Models.Dtos.Expense;

using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms.Xaml;

namespace MyApp.Views.Expense
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class ExpenseMiscellaneousSelectionPage : Popup<MiscellaneousItemDto>
    {
        public ExpenseMiscellaneousSelectionPage()
        {
            InitializeComponent();
        }
    }
}

Steps to Reproduce

  1. Create popup page
  2. Set xmlns:dto="clr-namespace:MyApp.Models.Dtos.Expense"
  3. Set x:TypeArguments="dto:MiscellaneousItemDto"
  4. On popup.xaml.cs inherit from same type Popup<MiscellaneousItemDto>

Expected Behavior

Should compile and run

Actual Behavior

Not compiling and showing error

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0263	Partial declarations of 'ExpenseMiscellaneousSelectionPage' must not specify different base classes		F:\Xamarin\MyApp\MyApp\MyApp\Views\Expense\ExpenseMiscellaneousSelectionPage.xaml.cs	10	

Basic Information

  • Version with issue: 1.2.0
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS: NA
    • Android: 11.0
    • UWP: NA
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

uzairali001 avatar Jul 27 '21 11:07 uzairali001

Could you maybe add a reproduction sample? As seen in this repo, this works. So I'm quite sure that this has to be something in your codebase rather than a bug on our side :)

The only difference I see between my sample and your code is the Toolkit version 1.1.0 vs 1.2.0 but I can hardly imagine this broke between these two versions

jfversluis avatar Jul 27 '21 13:07 jfversluis

@uzairali001 this is a really late response but you don't actually need to define the base type in the C# your class definition can simply look like:

public partial class ExpenseMiscellaneousSelectionPage

bijington avatar Jun 07 '22 09:06 bijington