/// <summary>
        /// Hinzufügen eines Kindobjektes zum Datagrid
        /// Author: Georg Schmid
        /// </summary>
        public void addNewChildtoDatagrid()
        {
            GrBChildren.IsEnabled = true;

            //Combobox belegen
            CBItem male = new CBItem();
            male.Name = "Männlich";
            CBItem female = new CBItem();
            female.Name = "Weiblich";
            List<CBItem> newGenderTypes = new List<CBItem>();
            newGenderTypes.Add(male);
            newGenderTypes.Add(female);

            if (_Childs.Count == 0)
            {
                //Hinzufügen eines Kindes ermöglichen
                ChildModel newChild = new ChildModel();
                newChild.genderType = newGenderTypes;
                newChild.ChildID = 0;
                newChild.FirstName = "";
                newChild.LastName = personLastName;
                newChild.Birthday = DateTime.Now;
                newChild.IsFemale = false;
                newChild.isAdded = false;
                this._Childs.Add(newChild);
            }
            else
            {
                //Prüfung ob alle zum Speichern vorgemerkt sind Nur dann Neue Zeile
                if (_Childs.Last().isAdded == true)
                {
                    //Hinzufügen eines Kindes ermöglichen
                    ChildModel newChild = new ChildModel();
                    newChild.genderType = newGenderTypes;
                    newChild.ChildID = 0;
                    newChild.FirstName = "";
                    newChild.LastName = personLastName;
                    newChild.Birthday = DateTime.Now;
                    newChild.IsFemale = false;
                    newChild.isAdded = false;
                    this._Childs.Add(newChild);
                }
            }

            dtgChildren.Items.Refresh();
            dtgChildren.ItemsSource = this._Childs;
            dtgChildren.Items.Refresh();
        }
        /// <summary>
        /// Hiermit werden die Änderungen in der Einkommensart-Combobox registriert und abgespeichert!!!
        /// 
        /// Author: Antonios Fesenmeier
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbRevTyp_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dtgRevenue2.SelectedCells.Count > 0)
            {
                var row = dtgRevenue2.SelectedCells.ElementAt(0);
                var currentSelectedRow = row.Item as RevenueModel;

                int rowId = dtgRevenue2.Items.IndexOf(currentSelectedRow);

                for (int rowIdx = 0; rowIdx < dtgRevenue2.Items.Count; rowIdx++)
                {
                    if (rowIdx == rowId)
                    {
                        var currentRow = dtgRevenue2.GetRow(rowIdx);
                        var actualChild = (RevenueModel)currentRow.Item;

                        ContentPresenter cbRevTyp = dtgRevenue2.Columns[0].GetCellContent(currentRow) as ContentPresenter;
                        var combobox = DataGridHelper.GetVisualChild<ComboBox>(cbRevTyp);
                        currentSelectedRow.revType = currentSelectedRow.revType.ToList();

                        List<CBItem> rowRevTypes = new List<CBItem>();
                        rowRevTypes.Add(combobox.SelectedItem as CBItem);

                        foreach (CBItem item in combobox.Items)
                        {
                            if (item != null)
                            {
                                if (!(item.Name.Equals((combobox.SelectedItem as CBItem).Name)))
                                {
                                    var newCBItem = new CBItem();
                                    newCBItem.Name = item.Name;
                                    rowRevTypes.Add(newCBItem);
                                }
                            }
                        }
                        currentSelectedRow.revType = rowRevTypes;
                    }

                }
                this._Revenues[rowId] = currentSelectedRow;
            }
        }
        private void pbAddDelChild_Click(object sender, RoutedEventArgs e)
        {
            _PartnerChildIsValid = true;
            pNewClientPerson pPerson = getPageFromTabs<pNewClientPerson>();
            var row = dtgChildren.SelectedCells.ElementAt(0);
            var currentSelectedRow = row.Item as ChildModel;
            int rowId = dtgChildren.Items.IndexOf(currentSelectedRow);
            DataGridRow currRow = dtgChildren.GetRow(rowId);

            if (currentSelectedRow.isAdded == false)
            {
                ////Prüfen des Kindes
                //if (CheckChildDataGrid())
                //{
                if (currentSelectedRow != null)
                {
                    ContentPresenter cpGender = dtgChildren.Columns[3].GetCellContent(currRow) as ContentPresenter;
                    var combobox = DataGridHelper.GetVisualChild<ComboBox>(cpGender);
                    CBItem cbGenderItem = (CBItem)combobox.SelectedItem;

                    if (cbGenderItem.Name == "Männlich")
                    {
                        currentSelectedRow.IsFemale = false;
                    }
                    else
                    {
                        currentSelectedRow.IsFemale = true;
                    }

                    //Combobox umsortieren
                    CBItem male = new CBItem();
                    male.Name = "Männlich";
                    CBItem female = new CBItem();
                    female.Name = "Weiblich";
                    List<CBItem> newGenderTypes = new List<CBItem>();
                    if (currentSelectedRow.IsFemale)
                    {
                        newGenderTypes.Add(female);
                        newGenderTypes.Add(male);
                    }
                    else
                    {
                        newGenderTypes.Add(male);
                        newGenderTypes.Add(female);
                    }

                    currentSelectedRow.genderType = newGenderTypes;
                    currentSelectedRow.isAdded = true;

                    dtgChildren.CommitEdit();
                    dtgChildren.Items.Refresh();

                    dtgChildren.Visibility = System.Windows.Visibility.Visible;
                    addNewChildtoDatagrid();
                    pPerson.pbNewChild.Visibility = System.Windows.Visibility.Hidden;
                }
                //}
                //else
                //{
                //    getErrorMsg();
                //}
            }
            else
            {

                var message = "Soll der gewählte Datensatz gelöscht werden?";

                var dialogResult = MessageBox.Show(message, "Bestätigung erfordert", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                if (dialogResult == MessageBoxResult.OK)
                {
                    this._Childs.RemoveAt(rowId);
                    dtgChildren.ItemsSource = this._Childs;

                    if (dtgChildren.Items.Count == 0)
                        addNewChildtoDatagrid();

                    dtgChildren.CommitEdit();
                    dtgChildren.Items.Refresh();
                }

            }

            pPerson.setNumberOfChild((this._Childs.Count - 1).ToString());
        }
        public void FillChildDataGrid(IEnumerable<Child> childs)
        {
            GrBChildren.IsEnabled = true;
            // Wenn das Datagrid nicht leer ist, müssen zunächst alle Zeilen gelöscht werden.
            // Folgedessen müssen soviele Zeilen erstellt werden wie es Kinder gibt!

            if (this._Childs.Count > 0)
                this._Childs.Clear();

            //Combobox belegen
            CBItem male = new CBItem();
            male.Name = "Männlich";
            CBItem female = new CBItem();
            female.Name = "Weiblich";

            if (!(childs.Count() == 0))
            {
                foreach (Child child in childs)
                {
                    List<CBItem> existingGenderTypes = new List<CBItem>();
                    if (child.IsFemale)
                    {
                        existingGenderTypes.Add(female);
                        existingGenderTypes.Add(male);
                    }
                    else
                    {
                        existingGenderTypes.Add(male);
                        existingGenderTypes.Add(female);
                    }

                    ChildModel existingChild = new ChildModel();
                    existingChild.genderType = existingGenderTypes;
                    existingChild.ChildID = child.ChildID;
                    existingChild.FirstName = child.FirstName;
                    existingChild.LastName = child.LastName;
                    existingChild.Birthday = child.DateOfBirth;
                    existingChild.IsFemale = child.IsFemale;
                    existingChild.isAdded = true;
                    this._Childs.Add(existingChild);
                }
            }

            dtgChildren.Items.Refresh();
            dtgChildren.ItemsSource = this._Childs;
            dtgChildren.Items.Refresh();
            addNewChildtoDatagrid();
        }