/* 2018-03-27
         * private void Row_MouseDoubleClick(object sender, MouseButtonEventArgs e)
         * {
         *  DataGridRow row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow;
         *  if (row == null) return;
         *  WindowBookEdit windowBookEdit = new WindowBookEdit();
         *  windowBookEdit.Owner = this;
         *
         *  //
         *  //// Binding hier erstellen, da das Binding aus XAML hier noch nicht aktiv ist
         *  //Binding b = new Binding("Title");
         *  //b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
         *  //// Vorname ist per default leer. Gleich hier mit einem Error markieren
         *  //BindingExpressionBase be = tbxBookTitel.SetBinding(TextBox.TextProperty, b);
         *
         *  //tbxBookTitel.Focus();
         *  //
         *
         *  // wewnn nächste Zeile aktiv ist, dann wird der Titel in BooksDetail nicht mehr gezeigt
         *  //      windowBookEdit.tbxBookTitel.Text = "mein Titel";
         *
         *
         *  if (windowBookEdit.ShowDialog() == true)
         *  {
         *      // do save or insert book
         *  }
         * }
         */


        private void Author_Row_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow;

            if (row == null)
            {
                return;
            }
            WindowAuthorEdit windowAuthorEdit = new WindowAuthorEdit();

            windowAuthorEdit.Owner = this;

/*
 *          string test = row.DataContext.ToString();
 *
 *          DataRow dr = (DataRow)row.DataContext;
 *          string value = dr[0].ToString();
 *
 *
 *          string author = row. ToString();
 */
            //  string name =   ((string)dataGridAuthor.Items[0].);

            if (windowAuthorEdit.ShowDialog() == true)
            {
                // do save or insert book
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.WindowsAuthorEdit = ((Wpf_EF_Mvvm_sample.WindowAuthorEdit)(target));
                return;

            case 2:
                this.tbxAuthorId = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.tbxAuthor = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.btnBookDelete = ((System.Windows.Controls.Button)(target));
                return;

            case 5:
                this.btnClose = ((System.Windows.Controls.Button)(target));

            #line 56 "..\..\WindowAuthorEdit.xaml"
                this.btnClose.Click += new System.Windows.RoutedEventHandler(this.btnClose_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.btnSave = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }