private void NumberTextBox_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (_loadingXml)
            {
                return;
            }

            Xceed.Wpf.Toolkit.DecimalUpDown numberTextBox = sender as Xceed.Wpf.Toolkit.DecimalUpDown;
            if (numberTextBox == null)
            {
                return;
            }

            JsonItem item = numberTextBox.Tag as JsonItem;

            if (item == null)
            {
                return;
            }

            JsonTab tab = null;

            if (item.ParentTab.TryGetTarget(out tab) == false)
            {
                return;
            }

            string xmlPath = tab.Path + item.Path + "/text()";

            _xmlDoc.SelectSingleNode(xmlPath).Value = e.NewValue.ToString();
        }
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (_loadingXml)
            {
                return;
            }

            CheckBox checkBox = sender as CheckBox;

            if (checkBox == null)
            {
                return;
            }

            JsonItem item = checkBox.Tag as JsonItem;

            if (item == null)
            {
                return;
            }

            JsonTab tab = null;

            if (item.ParentTab.TryGetTarget(out tab) == false)
            {
                return;
            }

            string xmlPath = tab.Path + item.Path + "/text()";

            _xmlDoc.SelectSingleNode(xmlPath).Value = ((checkBox.IsChecked == false || checkBox.IsChecked == null) ? "false" : "true");
        }
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (_loadingXml)
            {
                return;
            }

            TextBox textBox = sender as TextBox;

            if (textBox == null)
            {
                return;
            }

            JsonItem item = textBox.Tag as JsonItem;

            if (item == null)
            {
                return;
            }

            JsonTab tab = null;

            if (item.ParentTab.TryGetTarget(out tab) == false)
            {
                return;
            }

            string xmlPath = tab.Path + item.Path + "/text()";

            _xmlDoc.SelectSingleNode(xmlPath).Value = textBox.Text;
        }
        private void SeasonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_loadingXml)
            {
                return;
            }

            ComboBox seasonComboBox = sender as ComboBox;

            if (seasonComboBox == null)
            {
                return;
            }

            JsonItem item = seasonComboBox.Tag as JsonItem;

            if (item == null)
            {
                return;
            }

            JsonTab tab = null;

            if (item.ParentTab.TryGetTarget(out tab) == false)
            {
                return;
            }

            string xmlPath = tab.Path + item.Path + "/text()";

            string selectedSeason = seasonComboBox.SelectedItem.ToString();

            switch (selectedSeason)
            {
            case "Spring":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "spring";
                break;

            case "Summer":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "summer";
                break;

            case "Fall":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "fall";
                break;

            case "Winter":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "winter";
                break;
            }
        }
        private void GenderComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_loadingXml)
            {
                return;
            }

            ComboBox genderComboBox = sender as ComboBox;

            if (genderComboBox == null)
            {
                return;
            }

            JsonItem item = genderComboBox.Tag as JsonItem;

            if (item == null)
            {
                return;
            }

            JsonTab tab = null;

            if (item.ParentTab.TryGetTarget(out tab) == false)
            {
                return;
            }

            string xmlPath = tab.Path + item.Path + "/text()";

            string selectedGender = genderComboBox.SelectedItem.ToString();

            switch (selectedGender)
            {
            case "Male":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "true";
                break;

            case "Female":
                _xmlDoc.SelectSingleNode(xmlPath).Value = "false";
                break;
            }
        }