Closed to87al closed 2 years ago
how are you closing window without switching tab?
@vb2ae thanks for your reply. I have a main app window (MainViewModel) and I launch this child window (_windowManager.ShowDialogAsync(IoC.Get<SetupViewModel>())
) containing a TabControl with several TabItems as explained above. If I open the window and then close it without doing anything I get the above binding error. Meanwhile, if I open the window and switch to an other tab different from the default active one (FirstViewModel) I don't get any binding error. Returning to your question I just close it normally (window X button). If you haven't noticed a similar behavior before, I can attach a sample project. Thanks!
Hello, @vb2ae sorry for disturbing you. I just made a demo repository for reproducing this error.
Requisites: Windows 11 Visual Studio 2022 wpf .net 6 x64 Caliburn Micro 4.0.197
Steps to reproduce the error: 1-press button 'Show new window with TabControl' 2-simply close the new window.
Thanks for your time!
@to87al thanks I will look at this
Try changing your tabsview xaml to this. Here is a style that fixes the issue
<Window x:Class="DemoBug.Views.TabsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="TabsWindow" Height="450" Width="800">
Hello @vb2ae thanks a lot for your reply! At first I thought the problem was coming from CM, given that it customizes some control templates in background but according to your referenced link it's the control's implementation form WPF. Again, Thanks for your time and have a great time!
Hello, I'm working on a net6 wpf app. I have been getting e binding error while closing a window containing a tabcontrol with itemsource
Conductor<IScreen>.Collection.OneActive
. This is the code:If I launch the window and then close it without switching tab I get this binding error:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TabControl', AncestorLevel='1''. BindingExpression:Path=TabStripPlacement; DataItem=null; target element is 'TabItem' (Name=''); target property is 'NoTarget' (type 'Object')
If I switch to an other tab and then close the window I don't get any binding error. Is there any thing I can do to fix this? Thank you!