Пример #1
0
 public MemberFilterBox(ItemCollection items)
 {
     Orientation = Orientation.Horizontal;
     Margin      = WpfHelper.MenuItemMargin;
     Children.Add(ThemeHelper.GetImage(KnownImageIds.Filter).WrapMargin(WpfHelper.GlyphMargin));
     Children.Add(_FilterBox = new ThemedTextBox()
     {
         MinWidth = 150,
         ToolTip  = new ThemedToolTip("Result Filter", "Filter items in this menu.\nUse space to separate keywords.")
     });
     Children.Add(_FilterButtons = new MemberFilterButtonGroup());
     _Items = items;
     _FilterButtons.FilterChanged += FilterBox_Changed;
     _FilterButtons.FilterCleared += FilterBox_Clear;
     _FilterBox.TextChanged       += FilterBox_Changed;
 }
Пример #2
0
        public SymbolFilterBox(ISymbolFilterable filter)
        {
            Orientation = Orientation.Horizontal;
            Margin      = WpfHelper.MenuItemMargin;
            Children.Add(ThemeHelper.GetImage(IconIds.Filter).WrapMargin(WpfHelper.GlyphMargin));
            Children.Add(_FilterBox = new ThemedTextBox {
                MinWidth = 150,
                Margin   = WpfHelper.GlyphMargin,
                ToolTip  = new ThemedToolTip(R.T_ResultFilter, R.T_ResultFilterTip)
            });
            Children.Add(new Border {
                BorderThickness = WpfHelper.TinyMargin,
                CornerRadius    = new CornerRadius(3),
                Child           = _FilterContainer = new StackPanel {
                    Orientation = Orientation.Horizontal
                }
            }.ReferenceProperty(Border.BorderBrushProperty, CommonControlsColors.TextBoxBorderBrushKey));
            switch (filter.SymbolFilterKind)
            {
            case SymbolFilterKind.Type:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new TypeFilterButtonGroup() };
                break;

            case SymbolFilterKind.Usage:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new SymbolUsageFilterButtonGroup(), new MemberFilterButtonGroup() };
                break;

            default:
                _FilterGroups = new FilterButtonGroup[] { new AccessibilityFilterButtonGroup(), new MemberFilterButtonGroup() };
                break;
            }
            _FilterContainer.Add(_FilterGroups);
            _FilterContainer.Add(new ThemedButton(IconIds.ClearFilter, R.CMD_ClearFilter, ClearFilters).ClearBorder());
            _Filter = filter;
            foreach (var item in _FilterGroups)
            {
                item.FilterChanged += FilterBox_Changed;
            }
            _FilterBox.TextChanged += FilterBox_Changed;
            _FilterBox.SetOnVisibleSelectAll();
        }
Пример #3
0
 public SymbolFilterBox(ISymbolFilterable filter)
 {
     Orientation = Orientation.Horizontal;
     Margin      = WpfHelper.MenuItemMargin;
     Children.Add(ThemeHelper.GetImage(KnownImageIds.Filter).WrapMargin(WpfHelper.GlyphMargin));
     Children.Add(_FilterBox = new ThemedTextBox(true)
     {
         MinWidth = 150,
         ToolTip  = new ThemedToolTip("Result Filter", "Filter items in this menu.\nUse space to separate keywords.")
     });
     if (filter.SymbolFilterKind == SymbolFilterKind.Type)
     {
         Children.Add(_FilterButtons = new TypeFilterButtonGroup());
     }
     else
     {
         Children.Add(_FilterButtons = new MemberFilterButtonGroup());
     }
     _Filter = filter;
     _FilterButtons.FilterChanged += FilterBox_Changed;
     _FilterButtons.FilterCleared += FilterBox_Clear;
     _FilterBox.TextChanged       += FilterBox_Changed;
     _FilterBox.SetOnVisibleSelectAll();
 }
Пример #4
0
 public NumericUpDown()
 {
     Content = new Border {
         BorderThickness = WpfHelper.TinyMargin,
         Child           = new Grid {
             ColumnDefinitions =
             {
                 new ColumnDefinition {
                     Width = new GridLength(1, GridUnitType.Auto)
                 },
                 new ColumnDefinition {
                     Width = new GridLength(1, GridUnitType.Star)
                 },
                 new ColumnDefinition {
                     Width = new GridLength(1, GridUnitType.Auto)
                 }
             },
             Children =
             {
                 new ThemedButton(KnownImageIds.GlyphDown, null, Decrease)
                 {
                     BorderThickness = WpfHelper.TinyMargin
                 }.SetValue(Grid.SetColumn,                  0),
                 (_ValueBox = new ThemedTextBox {
                     BorderThickness = WpfHelper.NoMargin, TextAlignment = TextAlignment.Center
                 }.SetValue(Grid.SetColumn,                 1)),
                 new ThemedButton(KnownImageIds.GlyphUp,   null, Increase)
                 {
                     BorderThickness = WpfHelper.TinyMargin
                 }.SetValue(Grid.SetColumn,                  2),
             }
         }
     }.ReferenceProperty(BorderBrushProperty, CommonControlsColors.ButtonBorderBrushKey);
     _ValueBox.SetBinding(TextBox.TextProperty, new Binding {
         Source = this,
         Path   = new PropertyPath(ValueProperty),
         Mode   = BindingMode.TwoWay,
         NotifyOnSourceUpdated   = true,
         NotifyOnValidationError = true
     });
     _ValueBox.TextChanged += (s, args) => {
         var t = (TextBox)s;
         if (Int32.TryParse(t.Text, out int v) == false)
         {
             if (t.Text.Trim().Length == 0)
             {
                 Value  = 0;
                 t.Text = String.Empty;
             }
             else
             {
                 t.Text = Value.ToString();
             }
         }
         else
         {
             Value = v;
         }
     };
     _ValueBox.PreviewLostKeyboardFocus += (s, args) => {
         var t = (TextBox)s;
         if (t.Text.Length == 0)
         {
             t.Text = "0";
             Value  = 0;
         }
     };
 }