Skip to content

Unable to cast object of type 'DockXamlSample.ViewModels.UserControlItemViewModel' to type 'Dock.Model.Core.IDockable'. #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IldarKhayrutdinov opened this issue Dec 10, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@IldarKhayrutdinov
Copy link

IldarKhayrutdinov commented Dec 10, 2024

I use own hierarchy of data models without Dock models. Binding as described #228 (comment).
Add items data to model of ItemsControl throws exception (for each item):

Unable to cast object of type 'DockXamlSample.ViewModels.UserControlItemViewModel' to type 'Dock.Model.Core.IDockable'.

   at CompiledAvaloniaXaml.XamlIlHelpers.Dock.Model.Core.IDockable,Dock.Model.IsCollapsable!Getter(Object)
   at Avalonia.Data.Core.ClrPropertyInfo.Get(Object target)
   at Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.get_Value()
   at Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.SendCurrentValue()

The exceptions are suppressed and the window displays normally, but causes delays. There is no error when using ListBox.
Similar to #349, but on latest master throws.

Reproduction example:
DockXamlSample.zip
or https://github.com/IldarKhayrutdinov/Dock/tree/ItemsControl-Exception

@wieslawsoltes
Copy link
Owner

What version did you use?

@IldarKhayrutdinov
Copy link
Author

IldarKhayrutdinov commented Dec 15, 2024

The latest master revision at issue created time 9b5a3a3.
The current master reversion 371b790 also reproduces.

vadimart92 added a commit to vadimart92/Dock that referenced this issue Jan 30, 2025
@wieslawsoltes
Copy link
Owner

Should be fixed by 096c825

@wieslawsoltes wieslawsoltes added the bug Something isn't working label Feb 26, 2025
@IldarKhayrutdinov
Copy link
Author

IldarKhayrutdinov commented Mar 5, 2025

@wieslawsoltes
in latest revision 096c825 no exception, thanks!

I noticed something - DockXamlSample is broken - dock contents are empty
Image

@wieslawsoltes
Copy link
Owner

@wieslawsoltes in latest revision 096c825 no exception, thanks!

I noticed something - DockXamlSample is broken - dock contents are empty Image

#397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants