Esempio n. 1
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            NoboarderIconButton btn                = sender as NoboarderIconButton;
            Grid                g                  = VisualTreeHelper.GetParent(btn) as Grid;
            TextBlock           textBlockTitle     = g.FindName("textBlockTitle") as TextBlock;
            TextBox             textBoxNewValue    = g.FindName("textBoxNewValue") as TextBox;
            NoboarderIconButton btnDelete          = g.FindName("btnDelete") as NoboarderIconButton;
            NoboarderIconButton btnRename          = g.FindName("btnRename") as NoboarderIconButton;
            NoboarderIconButton btnSave            = g.FindName("btnSave") as NoboarderIconButton;
            NoboarderIconButton btnCancel          = g.FindName("btnCancel") as NoboarderIconButton;
            TextBlock           TextBlockErrorTip1 = g.FindName("TextBlockErrorTip1") as TextBlock;

            textBoxNewValue.Text = textBlockTitle.Text;

            TextBlockErrorTip1.Visibility = Visibility.Collapsed;
            textBlockTitle.Foreground     = GetTextStyle(false);
            textBlockTitle.Visibility     = Visibility.Visible;
            textBoxNewValue.Visibility    = Visibility.Collapsed;
            btnDelete.Visibility          = Visibility.Visible;
            btnRename.Visibility          = Visibility.Visible;
            btnSave.Visibility            = Visibility.Collapsed;
            btnCancel.Visibility          = Visibility.Collapsed;

            // Mark
            ICustomGridListItem content = g.DataContext as ICustomGridListItem;

            content.IsRenaming = false;
            content.IsDeleting = false;
        }
Esempio n. 2
0
        private void btnRename_Click(object sender, RoutedEventArgs e)
        {
            NoboarderIconButton btn = sender as NoboarderIconButton;
            Grid g = VisualTreeHelper.GetParent(btn) as Grid;

            TextBlock           textBlockTitle  = g.FindName("textBlockTitle") as TextBlock;
            TextBox             textBoxNewValue = g.FindName("textBoxNewValue") as TextBox;
            NoboarderIconButton btnDelete       = g.FindName("btnDelete") as NoboarderIconButton;
            NoboarderIconButton btnRename       = g.FindName("btnRename") as NoboarderIconButton;
            NoboarderIconButton btnSave         = g.FindName("btnSave") as NoboarderIconButton;
            NoboarderIconButton btnCancel       = g.FindName("btnCancel") as NoboarderIconButton;

            textBlockTitle.Visibility  = Visibility.Collapsed;
            textBoxNewValue.Visibility = Visibility.Visible;
            btnDelete.Visibility       = Visibility.Collapsed;
            btnRename.Visibility       = Visibility.Collapsed;
            btnSave.Visibility         = Visibility.Visible;
            btnCancel.Visibility       = Visibility.Visible;

            textBoxNewValue.Text = textBlockTitle.Text;
            textBoxNewValue.SelectAll();
            textBoxNewValue.Focus();

            // Mark
            ICustomGridListItem content = g.DataContext as ICustomGridListItem;

            content.IsRenaming = true;
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            NoboarderIconButton btn = sender as NoboarderIconButton;
            Grid g = VisualTreeHelper.GetParent(btn) as Grid;

            TextBlock textBlockTitle     = g.FindName("textBlockTitle") as TextBlock;
            TextBlock TextBlockErrorTip1 = g.FindName("TextBlockErrorTip1") as TextBlock;

            TextBlockErrorTip1.Visibility = Visibility.Visible;
            TextBox             textBoxNewValue = g.FindName("textBoxNewValue") as TextBox;
            NoboarderIconButton btnDelete       = g.FindName("btnDelete") as NoboarderIconButton;
            NoboarderIconButton btnRename       = g.FindName("btnRename") as NoboarderIconButton;
            NoboarderIconButton btnSave         = g.FindName("btnSave") as NoboarderIconButton;
            NoboarderIconButton btnCancel       = g.FindName("btnCancel") as NoboarderIconButton;

            TextBlockErrorTip1.Text = string.Empty;
            if (string.IsNullOrEmpty(textBoxNewValue.Text))
            {
                TextBlockErrorTip1.Text = Resource.ProflieDataGrid_CanNotBeEmptyTip;
                return;
            }
            else
            {
                var result = this.Dialog.OwningGrid.GridSettings.FirstOrDefault(p => p.Name.ToLower() == textBoxNewValue.Text.ToLower());
                if (result != null && result.Name != textBlockTitle.Text)
                {
                    TextBlockErrorTip1.Text = Resource.ProflieDataGrid_ExistsTip;
                    return;
                }
            }

            this.Dialog.Rename(textBlockTitle.Text, textBoxNewValue.Text.Trim());

            if (this.Dialog.TextBlockContent.Text == textBlockTitle.Text)
            {
                this.Dialog.TextBlockContent.Text = textBoxNewValue.Text.Trim();
                this.Dialog.TextBlockNeedCoverProfileName.Text = textBoxNewValue.Text.Trim();
            }
            TextBlockErrorTip1.Visibility = Visibility.Collapsed;
            textBlockTitle.Text           = textBoxNewValue.Text.Trim();
            (g.DataContext as ICustomGridListItem).DisplayContent = textBlockTitle.Text;
            textBlockTitle.Foreground  = GetTextStyle(false);
            textBlockTitle.Visibility  = Visibility.Visible;
            textBoxNewValue.Visibility = Visibility.Collapsed;
            btnDelete.Visibility       = Visibility.Visible;
            btnRename.Visibility       = Visibility.Visible;
            btnSave.Visibility         = Visibility.Collapsed;
            btnCancel.Visibility       = Visibility.Collapsed;

            // Mark
            ICustomGridListItem content = g.DataContext as ICustomGridListItem;

            content.IsRenaming = false;
        }
Esempio n. 4
0
        private void gridDataTemplate_MouseEnter(object sender, MouseEventArgs e)
        {
            Grid g = (sender as Grid);
            ICustomGridListItem content = g.DataContext as ICustomGridListItem;

            if (content.IsRenaming == false && content.IsDeleting == false)
            {
                NoboarderIconButton btnDelete = g.FindName("btnDelete") as NoboarderIconButton;
                NoboarderIconButton btnRename = g.FindName("btnRename") as NoboarderIconButton;

                btnDelete.Visibility = Visibility.Visible;
                btnRename.Visibility = Visibility.Visible;
            }
        }
Esempio n. 5
0
        private void btnSetDefault_Click(object sender, RoutedEventArgs e)
        {
            // Remove Old
            foreach (ICustomGridListItem item in m_Source)
            {
                item.DefaultIconVisibility = Visibility.Collapsed;
            }
            this.MainContentList.ItemsSource = null;
            this.MainContentList.ItemsSource = m_Source;

            // Set
            NoboarderIconButton btn = sender as NoboarderIconButton;
            Grid g = VisualTreeHelper.GetParent(btn) as Grid;

            Image imageDefaultIcon = g.FindName("imageDefaultIcon") as Image;

            imageDefaultIcon.Visibility = Visibility.Visible;
        }
Esempio n. 6
0
        private void gridDataTemplate_MouseLeave(object sender, MouseEventArgs e)
        {
            Grid g = (sender as Grid);
            ICustomGridListItem content = g.DataContext as ICustomGridListItem;

            if (content.IsRenaming == false && content.IsDeleting == false)
            {
                TextBlock           textBlockTitle  = g.FindName("textBlockTitle") as TextBlock;
                TextBox             textBoxNewValue = g.FindName("textBoxNewValue") as TextBox;
                NoboarderIconButton btnDelete       = g.FindName("btnDelete") as NoboarderIconButton;
                NoboarderIconButton btnRename       = g.FindName("btnRename") as NoboarderIconButton;
                NoboarderIconButton btnSave         = g.FindName("btnSave") as NoboarderIconButton;
                NoboarderIconButton btnCancel       = g.FindName("btnCancel") as NoboarderIconButton;

                textBlockTitle.Visibility  = Visibility.Visible;
                textBoxNewValue.Visibility = Visibility.Collapsed;
                btnDelete.Visibility       = Visibility.Collapsed;
                btnRename.Visibility       = Visibility.Collapsed;
                btnSave.Visibility         = Visibility.Collapsed;
                btnCancel.Visibility       = Visibility.Collapsed;
            }
        }