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

Throws System.Reflection.TargetInvocationException while dragging a tab when the tabs are created using ItemsSource. #276

Open
nima-ghomri opened this issue Mar 14, 2023 · 0 comments

Comments

@nima-ghomri
Copy link

I have a .NET 7 WPF project where I defined a view and a view model as below:

MainWindow.xaml

<Window x:Class="DragablzExamples.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
        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"
        xmlns:local="clr-namespace:DragablzExamples"
        mc:Ignorable="d"
        d:DataContext="{d:DesignInstance Type=local:MainWindowViewModel}"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <dragablz:TabablzControl ItemsSource="{Binding Items}" Margin="8">
            <dragablz:TabablzControl.InterTabController>
                <dragablz:InterTabController/>
            </dragablz:TabablzControl.InterTabController>
        </dragablz:TabablzControl>
    </Grid>
</Window>

MainWindow.xaml.cs

using System.Windows;

namespace DragablzExamples
{
    public class MainWindowViewModel
    {
        public string[] Items { get; set; } = new[] { "Item #1", "Item #2", "Item #3" };
    }
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            DataContext = new MainWindowViewModel();
            InitializeComponent();
        }
    }
}

When I try to drag a tab I get the System.Reflection.TargetInvocationException. It works perfectly when I add TabItems to the main container manually but it throws exception when I use binding. what is wrong with this simple view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant