Closed PavloLukianets closed 5 months ago
I'm going to look at merging this PR, but to be honest I'm conflicted. You shouldn't be trying to reference this type from net8.0 in your project. Can you provide more info about what code you are trying to use that is giving you this error?
Just added the net8.0 TF to support a test project
If u can recommend any other way to make a unit test project work with MAUI would be grateful!
My team are experiencing the same issue due to having a test project in our solution.
That PR would greatly help us.
Currently we are working around by doing the below in our MauiProgram:
public static MauiAppBuilder ConfigureVirtualListView(this MauiAppBuilder mauiAppBuilder)
{
#if IOS || ANDROID
mauiAppBuilder.UseVirtualListView();
#endif
return mauiAppBuilder;
}
And to create a custom adapter creating the below classes:
#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Adapters
{
public interface IVirtualListViewAdapter
{
void InvalidateData();
}
}
#endif
#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Adapters
{
public abstract class VirtualListViewAdapterBase<TSection, TItem>
where TItem : class
{
public abstract TItem GetItem(int sectionIndex, int itemIndex);
public abstract int GetNumberOfItemsInSection(int sectionIndex);
}
}
#endif
And to get the view working we did the below:
namespace MyHealth.Controls
{
public class VirtualListView : Microsoft.Maui.Controls.VirtualListView
{
}
}
#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Controls
{
public class VirtualListView : View
{
// Fake properties, methods and events
}
}
#endif
sill an issue with 0.3.2
Failing to build if added to such project, because of this: