benruehl / adonis-ui

Lightweight UI toolkit for WPF applications offering classic but enhanced windows visuals
https://benruehl.github.io/adonis-ui/
MIT License
1.69k stars 143 forks source link

TreeView File Explorer triggers XAML Binding Failures for root items #161

Open 7erra opened 3 years ago

7erra commented 3 years ago
Describe the bug Using Adonis UI leads to the following XAML Binding Error when using a custom TreeView to display files (project attached): Severity Count Data Context Binding Path Target Target Type Description
Error 13 null IsExpanded TreeViewItem.NoTarget Object Cannot find source: RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TreeViewItem', AncestorLevel='1'.

This error does not appear when removing Adonis from the project. It also does not break the application, it just logs this error.

To Reproduce Steps to reproduce the behavior:

  1. Download the attached VS2019 project
  2. Open the solution file with Visual Studio 2019 Community Edition
  3. Change the target folder ("P:\BIKIUtils") to a valid directory in MainWindow.xaml.cs
  4. Debug the program
  5. The error appears when the DataContext is set in MainWindow.xaml.cs

Expected behavior No error warning should appear, just like when running the program without Adonis.

Screenshots image

Additional context Minimal project: Testing.zip

The code is from this SO answer: https://stackoverflow.com/a/6560891/11370741

Note about myself: I am very new to C# and WPF, just fyi. PS.: I love the functionality of Adonis, great looks and easy implementation 👍