Skip to content

Commit 5762f55

Browse files
[release/10.0.1xx-preview1] [net10.0] Make CV2 default for net10 (#27616)
* [iOS] Make cv2 the default CollectionView handlers Handlers again * Update MauiProgram.cs * [tests] Remove CV2 test --------- Co-authored-by: Rui Marinho <[email protected]>
1 parent cfd93fb commit 5762f55

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed

src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#elif IOS || MACCATALYST
2020
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
2121
using Microsoft.Maui.Controls.Handlers.Compatibility;
22+
using Microsoft.Maui.Controls.Handlers.Items2;
2223
#elif TIZEN
2324
using Microsoft.Maui.Controls.Handlers.Compatibility;
2425
using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
@@ -61,8 +62,13 @@ public static partial class AppHostBuilderExtensions
6162

6263
internal static IMauiHandlersCollection AddControlsHandlers(this IMauiHandlersCollection handlersCollection)
6364
{
65+
#if IOS || MACCATALYST
66+
handlersCollection.AddHandler<CollectionView, CollectionViewHandler2>();
67+
handlersCollection.AddHandler<CarouselView, CarouselViewHandler2>();
68+
#else
6469
handlersCollection.AddHandler<CollectionView, CollectionViewHandler>();
6570
handlersCollection.AddHandler<CarouselView, CarouselViewHandler>();
71+
#endif
6672
handlersCollection.AddHandler<Application, ApplicationHandler>();
6773
handlersCollection.AddHandler<ActivityIndicator, ActivityIndicatorHandler>();
6874
handlersCollection.AddHandler<BoxView, BoxViewHandler>();

src/Templates/src/templates/maui-mobile/MauiProgram.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ public static MauiApp CreateMauiApp()
1818
#if (IncludeSampleContent)
1919
.UseMauiCommunityToolkit()
2020
.ConfigureSyncfusionToolkit()
21-
.ConfigureMauiHandlers(handlers =>
22-
{
23-
//-:cnd:noEmit
24-
#if IOS || MACCATALYST
25-
handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();
26-
#endif
27-
//+:cnd:noEmit
28-
})
2921
#endif
3022
.ConfigureFonts(fonts =>
3123
{

src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -333,32 +333,4 @@ public void BuildWithDifferentVersionNumber(string id, string config, string dis
333333
Assert.IsTrue(DotnetInternal.Build(projectFile, config, properties: buildProps, msbuildWarningsAsErrors: true),
334334
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
335335
}
336-
337-
// This test is super temporary and is just for the interim
338-
// while we productize the CollectionViewHandler2. Once we
339-
// ship it as the default, this test will fail and can be deleted.
340-
[Test]
341-
[TestCase("maui", DotNetCurrent, "", false)]
342-
[TestCase("maui", DotNetCurrent, "--sample-content", true)]
343-
public void SampleShouldHaveHandler2Registered(string id, string framework, string additionalDotNetNewParams, bool shouldHaveHandler2)
344-
{
345-
var projectDir = TestDirectory;
346-
var programFile = Path.Combine(projectDir, "MauiProgram.cs");
347-
348-
Assert.IsTrue(DotnetInternal.New(id, projectDir, framework, additionalDotNetNewParams),
349-
$"Unable to create template {id}. Check test output for errors.");
350-
351-
var programContents = File.ReadAllText(programFile);
352-
353-
if (shouldHaveHandler2)
354-
{
355-
AssertContains("#if IOS || MACCATALYST", programContents);
356-
AssertContains("handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();", programContents);
357-
}
358-
else
359-
{
360-
AssertDoesNotContain("#if IOS || MACCATALYST", programContents);
361-
AssertDoesNotContain("handlers.AddHandler<Microsoft.Maui.Controls.CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();", programContents);
362-
}
363-
}
364336
}

0 commit comments

Comments
 (0)