Closed cirrusone closed 6 months ago
I'll take a look on Sunday Feb 11th. Sorry, just noticed it.
I noticed something else with this...
If I manually set the grid source in code-behind using this instead...
<TreeDataGrid x:Name="treeDataGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
and
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
var people = new List<Person>
{
new Person { Forename = "Forename1", Surname = "Surname1", Age = 32 },
new Person { Forename = "Forename2", Surname = "Surname2", Age = 74 },
new Person { Forename = "Forename3", Surname = "Surname3", Age = 16 },
new Person { Forename = "Forename4", Surname = "Surname4", Age = 52 }
};
People = new ObservableCollection<Person>(people);
Source = new FlatTreeDataGridSource<Person>(People)
{
Columns =
{
new TextColumn<Person, string>("Forename", x => x.Forename),
new TextColumn<Person, string>("Surname", x => x.Surname),
new TextColumn<Person, int>("Age", x => x.Age),
},
};
treeDataGrid.Source = Source;
}
public ObservableCollection<Person> People { get; set; }
public FlatTreeDataGridSource<Person> Source { get; set; }
}
then the DockItem tabs can be moved without it crashing.
The crash only occurs when setting source via MVVM binding to viewmodel using
<TreeDataGrid Source="{Binding Source}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
Sorry, I should have asked you before - can you create a small sample that compiles and runs in some public repository on github. I'll make it work then. Thanks
There's a link to full .sln/.proj with error in the initial post. Full sample project with error -> DataGridAot.zip
First of all the UniDock still depends on Avalonia 6. I updated your references to only depend on Avalonia 6 and also also upgraded NP.Ava.UniDock to the latest version - 1.0.6 and everything was working fine - no exceptions.
The only problem is that your view model was tied to the MainView so no data appeared in the dragged out window. In order to bind the View Models correctly, please, see the end of the article UniDock Power Features starting with "Using View Models with the DockManager" section
DataGridAot.zip Here is the modified code that runs without exceptions.
please, close the issue, if you question was answered.
Since there is no answer - closing this issue (apparently it happened because of the Avalonia dll mismatch.
I get the following error when moving a DockItem containing a TreeGridView. The TreeGridView displays fine inside the DockItem but the error is raised only when attempting to dock.
Error:
MainView.axaml:
Full sample project with error -> DataGridAot.zip