Beispiel #1
0
        private static void AddItem(TokenContainerControl userControl)
        {
            var tb   = VisualHelper.FindChild <TextBox>(userControl, "MainTextBox");
            var item = tb.Text;

            if (string.IsNullOrEmpty(item))
            {
                return;
            }

            // Add token
            var currentItems = userControl.SelectedItemsCSV != null?userControl.SelectedItemsCSV.Split(',') : new string[]
            {
            };

            if (!currentItems.Contains(item))
            {
                userControl.SelectedItemsCSV = string.Join(",", currentItems.Where(x => !string.IsNullOrEmpty(x)).Union(new List <string> {
                    item
                }));
            }

            System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() =>
            {
                userControl.TextBoxText = string.Empty;
            }));
        }
Beispiel #2
0
        private static void StopEdit(TokenContainerControl control)
        {
            var tb   = VisualHelper.FindChild <TextBox>(control, "MainTextBox");
            var grid = (Grid)tb.Parent;

            grid.ColumnDefinitions[0].Width = new GridLength(0);
            grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);
        }
Beispiel #3
0
        private static void StartEdit(TokenContainerControl control)
        {
            var tb   = control.MainTextBox;
            var grid = (Grid)tb.Parent;

            grid.ColumnDefinitions[0].Width = new GridLength(3, GridUnitType.Star);
            grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);

            tb.Focus();
        }