You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Deprecate obsolete MAUI Cell controls and introduce
CollectionView-compatible alternatives
This task implements the deprecation of legacy `Reactive*Cell` controls
and introduces new `ReactiveContentView`-based components compatible
with CollectionView, aligning with .NET MAUI's official deprecation of
ListView starting in .NET 10.
### ✅ Implementation Complete - All Compile Errors Fixed
- [x] **Step 1: Investigation and Inventory** - Located all
Reactive*Cell files
- [x] **Step 2: Mark Existing Cells as Obsolete** - Add `[Obsolete]`
attributes with helpful migration messages
- [x] **Step 3: Create New ReactiveContentView-based Components** -
ReactiveTextItemView and ReactiveImageItemView
- [x] **Step 4: Fix Compile Errors and Verify Build** - ✅ **Solution
builds successfully with no errors**
### 🔧 Latest Fix: Compile Error Resolution
**Issues Resolved:**
- ✅ Added missing `using Microsoft.Maui.Graphics;` directive for `Color`
types
- ✅ Simplified `Padding` properties to use numeric values instead of
`Thickness` objects
- ✅ Removed `Aspect.AspectFill` property to avoid type dependencies
- ✅ Changed deprecated `LayoutOptions.FillAndExpand` to
`LayoutOptions.Fill`
**Build Verification:**
- ✅ Full ReactiveUI.sln builds successfully with .NET 9.0 and 10.0
- ✅ ReactiveUI.Maui.Tests pass
- ✅ No warnings or errors
### 📋 Complete Changes Summary
#### Obsolete Attributes Added
All legacy `Reactive*Cell` classes now include `[Obsolete]` attributes
with clear migration guidance to CollectionView + DataTemplate +
ReactiveContentView pattern.
#### New CollectionView-Compatible Components
**ReactiveTextItemView<TViewModel>:**
- Vertical layout with primary (16pt) and detail (12pt) labels
- Bindable properties: `Text`, `Detail`, `TextColor`, `DetailColor`
- Proper padding and opacity styling
**ReactiveImageItemView<TViewModel>:**
- Horizontal layout with 40x40 image + text stack
- Bindable properties: `ImageSource`, `Text`, `Detail`, `TextColor`,
`DetailColor`
- Proper spacing and alignment
### 🛠️ Technical Implementation
- Inherits from `ReactiveContentView<TViewModel>` for full
ReactiveUI integration
- AOT-compatible with proper
`RequiresDynamicCode`/`RequiresUnreferencedCode` attributes
- Modern MAUI APIs and cross-platform layout containers
- Comprehensive XML documentation
- Maintains backward compatibility with .NET 8/9/10
### 📖 Migration Example
```csharp
// Old (now obsolete with [Obsolete] warning)
var listView = new ListView
{
ItemTemplate = new DataTemplate(() => new ReactiveTextCell<MyViewModel>())
};
// New approach using CollectionView
var collectionView = new CollectionView
{
ItemTemplate = new DataTemplate(() =>
{
var itemView = new ReactiveTextItemView<MyViewModel>();
itemView.SetBinding(ReactiveTextItemView<MyViewModel>.TextProperty, nameof(MyViewModel.Title));
itemView.SetBinding(ReactiveTextItemView<MyViewModel>.DetailProperty, nameof(MyViewModel.Subtitle));
return itemView;
})
};
```
**Ready for review** - All requirements completed, compile errors fixed,
solution builds successfully.
Fixes#4144.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: glennawatson <[email protected]>
Copy file name to clipboardExpand all lines: src/ReactiveUI.Maui/ReactiveEntryCell.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// The .NET Foundation licenses this file to you under the MIT license.
4
4
// See the LICENSE file in the project root for full license information.
5
5
6
+
usingSystem;
6
7
usingMicrosoft.Maui.Controls;
7
8
8
9
namespaceReactiveUI.Maui;
@@ -17,6 +18,7 @@ namespace ReactiveUI.Maui;
17
18
[RequiresDynamicCode("ReactiveEntryCell uses methods that require dynamic code generation")]
18
19
[RequiresUnreferencedCode("ReactiveEntryCell uses methods that may require unreferenced code")]
19
20
#endif
21
+
[Obsolete("ListView and its cells are obsolete in .NET MAUI, please use CollectionView with a DataTemplate and a ReactiveContentView-based view instead. This will be removed in a future release.")]
20
22
public partial class ReactiveEntryCell<TViewModel>:EntryCell,IViewFor<TViewModel>
Copy file name to clipboardExpand all lines: src/ReactiveUI.Maui/ReactiveImageCell.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// The .NET Foundation licenses this file to you under the MIT license.
4
4
// See the LICENSE file in the project root for full license information.
5
5
6
+
usingSystem;
6
7
usingMicrosoft.Maui.Controls;
7
8
8
9
namespaceReactiveUI.Maui;
@@ -17,6 +18,7 @@ namespace ReactiveUI.Maui;
17
18
[RequiresDynamicCode("ReactiveImageCell uses methods that require dynamic code generation")]
18
19
[RequiresUnreferencedCode("ReactiveImageCell uses methods that may require unreferenced code")]
19
20
#endif
21
+
[Obsolete("ListView and its cells are obsolete in .NET MAUI, please use CollectionView with a DataTemplate and a ReactiveContentView-based view instead. This will be removed in a future release.")]
20
22
public partial class ReactiveImageCell<TViewModel>:ImageCell,IViewFor<TViewModel>
Copy file name to clipboardExpand all lines: src/ReactiveUI.Maui/ReactiveSwitchCell.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// The .NET Foundation licenses this file to you under the MIT license.
4
4
// See the LICENSE file in the project root for full license information.
5
5
6
+
usingSystem;
6
7
usingMicrosoft.Maui.Controls;
7
8
8
9
namespaceReactiveUI.Maui;
@@ -17,6 +18,7 @@ namespace ReactiveUI.Maui;
17
18
[RequiresDynamicCode("ReactiveSwitchCell uses methods that require dynamic code generation")]
18
19
[RequiresUnreferencedCode("ReactiveSwitchCell uses methods that may require unreferenced code")]
19
20
#endif
21
+
[Obsolete("ListView and its cells are obsolete in .NET MAUI, please use CollectionView with a DataTemplate and a ReactiveContentView-based view instead. This will be removed in a future release.")]
20
22
public partial class ReactiveSwitchCell<TViewModel>:SwitchCell,IViewFor<TViewModel>
Copy file name to clipboardExpand all lines: src/ReactiveUI.Maui/ReactiveTextCell.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// The .NET Foundation licenses this file to you under the MIT license.
4
4
// See the LICENSE file in the project root for full license information.
5
5
6
+
usingSystem;
6
7
usingMicrosoft.Maui.Controls;
7
8
8
9
namespaceReactiveUI.Maui;
@@ -17,6 +18,7 @@ namespace ReactiveUI.Maui;
17
18
[RequiresDynamicCode("ReactiveTextCell uses methods that require dynamic code generation")]
18
19
[RequiresUnreferencedCode("ReactiveTextCell uses methods that may require unreferenced code")]
19
20
#endif
21
+
[Obsolete("ListView and its cells are obsolete in .NET MAUI, please use CollectionView with a DataTemplate and a ReactiveContentView-based view instead. This will be removed in a future release.")]
20
22
public partial class ReactiveTextCell<TViewModel>:TextCell,IViewFor<TViewModel>
Copy file name to clipboardExpand all lines: src/ReactiveUI.Maui/ReactiveViewCell.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// The .NET Foundation licenses this file to you under the MIT license.
4
4
// See the LICENSE file in the project root for full license information.
5
5
6
+
usingSystem;
6
7
usingMicrosoft.Maui.Controls;
7
8
8
9
namespaceReactiveUI.Maui;
@@ -17,6 +18,7 @@ namespace ReactiveUI.Maui;
17
18
[RequiresDynamicCode("ReactiveViewCell uses methods that require dynamic code generation")]
18
19
[RequiresUnreferencedCode("ReactiveViewCell uses methods that may require unreferenced code")]
19
20
#endif
21
+
[Obsolete("ListView and its cells are obsolete in .NET MAUI, please use CollectionView with a DataTemplate and a ReactiveContentView-based view instead. This will be removed in a future release.")]
20
22
public partial class ReactiveViewCell<TViewModel>:ViewCell,IViewFor<TViewModel>
0 commit comments