Skip to content

Update reactive tree item#226

Merged
ChrisPulman merged 4 commits intomasterfrom
UpdateReactiveTreeItem
Mar 8, 2026
Merged

Update reactive tree item#226
ChrisPulman merged 4 commits intomasterfrom
UpdateReactiveTreeItem

Conversation

@ChrisPulman
Copy link
Member

Update view bindings, tree controls, and package versions.

  • MAUI: raised Android SupportedOSPlatformVersion from 21.0 to 23.0.
  • Gallery views: bind PersonView and PetView to DisplayName instead of Name.
  • ReactiveTreeItem: batch-add children via Children.Edit, set child parent, and add Dispose override to dispose Children.
  • ReactiveTreeView: use ReactiveUI.SourceGenerators [IViewFor] attribute, register view with Splat generically, replace direct ViewModel DP plumbing with reactive WhenAnyValue/Subscribe to Children.CurrentItems.
  • ReactiveTreeViewModel: add Dispose override to dispose Children.
  • TreeView: implement GetContainerForItemOverride, IsItemItsOwnContainerOverride, and robust OnSelectedItemChanged to update SelectedItemProperty.
  • CrissCross.WPF.UI: replace external ReactiveList package with a local ProjectReference and add ReactiveList project to solution.
  • Directory.Packages.props: bump several package versions (Avalonia, ReactiveUI, ReactiveUI.Avalonia, Microsoft.Extensions packages, Microsoft.Xaml.Behaviors.Wpf, Polyfill, Microsoft.SourceLink.GitHub).

These changes fix bindings, improve tree view selection/container behavior, ensure children lists are disposed to avoid leaks, and update dependencies to newer versions.

Add first-class icon support for reactive tree items and their templates.

  • Person: initialize sample Item icon (ImageIcon) and add BitmapImage using directive.
  • ReactiveTreeItem: add reactive Icon backing field.
  • ReactiveTreeView.xaml: provide ItemContainerStyle to bind IsSelected/IsExpanded and Icon to the item container.
  • TreeView.xaml: add DefaultReactiveTreeViewStyle and register it so ReactiveTreeView gets a default template supporting scrolling and virtualization.
  • TreeViewItem: add IconVisibility dependency property, update Icon setter to toggle visibility, add IconPropertyChanged handler, and override container methods so items are TreeViewItem containers.
  • TreeViewItem.xaml: bind icon Visibility to IconVisibility, adjust layout/min widths and focus visual resource.
  • ControlMixins: remove unused using directives.

These changes allow icons to be provided by view models and displayed/hidden automatically in tree item templates, with a default ReactiveTreeView style and sample usage in the gallery.

Replace custom disposable/subject-based tree traversal with pure Rx operators. The patch removes unused usings, adds null checks (NET8_0_OR_GREATER conditional), and rewrites FlattenAndSelect/Flatten to use Select, Switch, Concat and Merge. Introduces helper methods FlattenItems and FlattenItem to produce IObservable streams from root lists and children, simplifying subscription management and eliminating manual CompositeDisposable/ReplaySubject logic. Also updates XML comments to better describe parameters and return values.

Update view bindings, tree controls, and package versions.

- MAUI: raised Android SupportedOSPlatformVersion from 21.0 to 23.0.
- Gallery views: bind PersonView and PetView to DisplayName instead of Name.
- ReactiveTreeItem: batch-add children via Children.Edit, set child parent, and add Dispose override to dispose Children.
- ReactiveTreeView: use ReactiveUI.SourceGenerators [IViewFor<T>] attribute, register view with Splat generically, replace direct ViewModel DP plumbing with reactive WhenAnyValue/Subscribe to Children.CurrentItems.
- ReactiveTreeViewModel: add Dispose override to dispose Children.
- TreeView: implement GetContainerForItemOverride, IsItemItsOwnContainerOverride, and robust OnSelectedItemChanged to update SelectedItemProperty.
- CrissCross.WPF.UI: replace external ReactiveList package with a local ProjectReference and add ReactiveList project to solution.
- Directory.Packages.props: bump several package versions (Avalonia, ReactiveUI, ReactiveUI.Avalonia, Microsoft.Extensions packages, Microsoft.Xaml.Behaviors.Wpf, Polyfill, Microsoft.SourceLink.GitHub).

These changes fix bindings, improve tree view selection/container behavior, ensure children lists are disposed to avoid leaks, and update dependencies to newer versions.
Add first-class icon support for reactive tree items and their templates.

- Person: initialize sample Item icon (ImageIcon) and add BitmapImage using directive.
- ReactiveTreeItem: add reactive Icon backing field.
- ReactiveTreeView.xaml: provide ItemContainerStyle to bind IsSelected/IsExpanded and Icon to the item container.
- TreeView.xaml: add DefaultReactiveTreeViewStyle and register it so ReactiveTreeView gets a default template supporting scrolling and virtualization.
- TreeViewItem: add IconVisibility dependency property, update Icon setter to toggle visibility, add IconPropertyChanged handler, and override container methods so items are TreeViewItem containers.
- TreeViewItem.xaml: bind icon Visibility to IconVisibility, adjust layout/min widths and focus visual resource.
- ControlMixins: remove unused using directives.

These changes allow icons to be provided by view models and displayed/hidden automatically in tree item templates, with a default ReactiveTreeView style and sample usage in the gallery.
Replace custom disposable/subject-based tree traversal with pure Rx operators. The patch removes unused usings, adds null checks (NET8_0_OR_GREATER conditional), and rewrites FlattenAndSelect/Flatten to use Select, Switch, Concat and Merge. Introduces helper methods FlattenItems and FlattenItem to produce IObservable<ReactiveTreeItem> streams from root lists and children, simplifying subscription management and eliminating manual CompositeDisposable/ReplaySubject logic. Also updates XML comments to better describe parameters and return values.
Bump MAUI example to net10 and align Android/min SDK and packages. Changes include:

- CrissCross.MAUI.Example.csproj: TargetFrameworks updated to net10.0-android (and net10.0-windows on Windows); add android-only PackageReference for Xamarin.AndroidX.Compose.Runtime.Annotation.Jvm (ExcludeAssets/PrivateAssets).
- CrissCross.MAUI.csproj: Android SupportedOSPlatformVersion raised from 21.0 to 23.0; add same android-only Compose annotation package reference.
- ControlMixins.cs: remove unused using System.Linq.
- CrissCross.WPF.UI.csproj: enable ReactiveList package reference and remove local project reference to the ReactiveList source.
- CrissCross.sln: remove the ReactiveList project entry and associated solution configuration entries.
- Directory.Packages.props: bump Microsoft.Xaml.Behaviors.Wpf and Polyfill versions, and add Xamarin.AndroidX.Compose.Runtime.Annotation package versions for Android.

These updates migrate MAUI targets to .NET 10, align Android min SDK and compose annotation deps, switch to the packaged ReactiveList (instead of a local project), and clean up unused imports.
@ChrisPulman ChrisPulman merged commit 3920074 into master Mar 8, 2026
1 check passed
@ChrisPulman ChrisPulman deleted the UpdateReactiveTreeItem branch March 8, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant