Skip to content
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

SimpleChildWindow does not behave like a ContentControl, Content can only be a Visual #61

Closed
Mertsch opened this issue Nov 24, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@Mertsch
Copy link

Mertsch commented Nov 24, 2017

v1.4.1

System.InvalidOperationException: 'xxxViewModel' is not a Visual or Visual3D.
   at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at System.Windows.Media.VisualTreeHelper.GetChildrenCount(DependencyObject reference)
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<GetChildObjects>d__4.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 182
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<FindChildren>d__3`1.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 140
   at MahApps.Metro.SimpleChildWindow.Utils.TreeHelper.<FindChildren>d__3`1.MoveNext() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\Utils\TreeHelper.cs:line 149
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at MahApps.Metro.SimpleChildWindow.ChildWindow.TryFocusElement() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\ChildWindow.cs:line 692
   at MahApps.Metro.SimpleChildWindow.ChildWindow.<>c__DisplayClass131_0.<IsOpenedChanged>b__0() in d:\projects\git\MahApps.Metro.SimpleChildWindow\src\MahApps.Metro.SimpleChildWindow\ChildWindow.cs:line 659

Workaround

<metroWindow:ChildWindow>
    <ContentPresenter Content="{Binding Path=xxxViewModel, Mode=OneWay}"/>
</metroWindow:ChildWindow>
@punker76 punker76 added the Bug label Nov 24, 2017
@punker76 punker76 self-assigned this Nov 24, 2017
@punker76 punker76 added this to the 1.5.0 milestone Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants