Repository: dotnet/maui
File: src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs (C#)

Code before:
		{
			Padding = 10,
			Children =
			{
				grid,
				collectionView
			}
		};

		Content = stackLayout;
	}

	void OnMeasureItemButtonClicked(object sender, EventArgs e)
	{
		var button = (Button)sender;
		if (button.Text == "MeasureFirstItem")
		{
			collectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem;
		}
		else
		{
			collectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureAllItems;
		}
	}
}
public class CollectionViewViewModel

{
	public ObservableCollection<ItemModel> Items { get; } = new()
	{
		new ItemModel("Short Text", 14, "29130Item1"),
		new ItemModel("Short Text expanded to test sizing. Just a few more words added.", 18, "29130Item2"),
		new ItemModel("This is a bit longer text that continues with additional words to create a slightly larger visual footprint.This is a bit longer text that continues with additional words to create a slightly larger visual footprint.This is a bit longer text that continues with additional words to create a slightly larger visual footprint.", 24, "29130Item3"),
	};
}

public class ItemModel
{
	public string Text { get; }
	public double FontSize { get; }

	public string AutomationId { get; set; }

	public ItemModel(string text, double fontSize, string automationId = null)
	{
		AutomationId = automationId;
		Text = text;
		FontSize = fontSize;
	}

}

Review comment (suggestion):
Modify this class to be something unique like `Issue29130ViewModel`.
```
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-maccatalyst]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-tizen]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-ios]
/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Issues/Issue29130.cs(88,14): error CS0101: The namespace 'Maui.Controls.Sample.Issues' already contains a definition for 'CollectionViewViewModel' [/Users/builder/azdo/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net9.0-android]
    1 Warning(s)
    4 Error(s)

```

Code after:
			ItemTemplate = new DataTemplate(() =>
			{
				var label = new Label();
				label.SetBinding(Label.TextProperty, "Text");
				label.SetBinding(Label.FontSizeProperty, "FontSize");
				label.SetBinding(Label.AutomationIdProperty, "AutomationId");
				return label;
			})
		};
		collectionView.SetBinding(ItemsView.ItemsSourceProperty, "Items");

		var stackLayout = new StackLayout
		{
			Padding = 10,
			Children =
			{
				grid,
				collectionView
			}
		};

		Content = stackLayout;
	}

	void OnMeasureItemButtonClicked(object sender, EventArgs e)
	{
		var button = (Button)sender;
		if (button.Text == "MeasureFirstItem")
		{
			collectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem;
		}
		else
		{
			collectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureAllItems;
		}
	}

	void OnChangeTemplateButtonClicked(object sender, EventArgs e)
	{
		isUsingAlternateTemplate = !isUsingAlternateTemplate;

		if (isUsingAlternateTemplate)
		{
			// Switch to alternate template with different styling
			collectionView.ItemTemplate = new DataTemplate(() =>
			{
				var border = new Border
				{
					BackgroundColor = Colors.LightBlue,
					Stroke = Colors.Blue,
					StrokeThickness = 2,