|
| 1 | +using System.Collections.ObjectModel; |
| 2 | +using Windows.UI.Text; |
| 3 | +using Windows.UI.Xaml; |
| 4 | +using Windows.UI.Xaml.Controls; |
| 5 | +using Windows.UI.Xaml.Media; |
| 6 | + |
| 7 | +namespace Microsoft.Toolkit.Uwp.UI.Controls |
| 8 | +{ |
| 9 | + public partial class RichSuggestBox |
| 10 | + { |
| 11 | + public static readonly DependencyProperty PlaceholderTextProperty = |
| 12 | + DependencyProperty.Register( |
| 13 | + nameof(PlaceholderText), |
| 14 | + typeof(string), |
| 15 | + typeof(RichSuggestBox), |
| 16 | + new PropertyMetadata(string.Empty)); |
| 17 | + |
| 18 | + public static readonly DependencyProperty RichEditBoxStyleProperty = |
| 19 | + DependencyProperty.Register( |
| 20 | + nameof(RichEditBoxStyle), |
| 21 | + typeof(Style), |
| 22 | + typeof(RichSuggestBox), |
| 23 | + new PropertyMetadata(null)); |
| 24 | + |
| 25 | + public static readonly DependencyProperty HeaderProperty = |
| 26 | + DependencyProperty.Register( |
| 27 | + nameof(Header), |
| 28 | + typeof(object), |
| 29 | + typeof(RichSuggestBox), |
| 30 | + new PropertyMetadata(null)); |
| 31 | + |
| 32 | + public static readonly DependencyProperty DescriptionProperty = |
| 33 | + DependencyProperty.Register( |
| 34 | + nameof(Description), |
| 35 | + typeof(object), |
| 36 | + typeof(RichSuggestBox), |
| 37 | + new PropertyMetadata(null)); |
| 38 | + |
| 39 | + public static readonly DependencyProperty TextWrappingProperty = |
| 40 | + DependencyProperty.Register( |
| 41 | + nameof(TextWrapping), |
| 42 | + typeof(TextWrapping), |
| 43 | + typeof(RichSuggestBox), |
| 44 | + new PropertyMetadata(TextWrapping.NoWrap)); |
| 45 | + |
| 46 | + public static readonly DependencyProperty ClipboardCopyFormatProperty = |
| 47 | + DependencyProperty.Register( |
| 48 | + nameof(ClipboardCopyFormat), |
| 49 | + typeof(RichEditClipboardFormat), |
| 50 | + typeof(RichSuggestBox), |
| 51 | + new PropertyMetadata(RichEditClipboardFormat.PlainText)); |
| 52 | + |
| 53 | + public static readonly DependencyProperty SuggestionBackgroundProperty = |
| 54 | + DependencyProperty.Register( |
| 55 | + nameof(SuggestionBackground), |
| 56 | + typeof(SolidColorBrush), |
| 57 | + typeof(RichSuggestBox), |
| 58 | + new PropertyMetadata(null)); |
| 59 | + |
| 60 | + public static readonly DependencyProperty SuggestionForegroundProperty = |
| 61 | + DependencyProperty.Register( |
| 62 | + nameof(SuggestionForeground), |
| 63 | + typeof(SolidColorBrush), |
| 64 | + typeof(RichSuggestBox), |
| 65 | + new PropertyMetadata(null)); |
| 66 | + |
| 67 | + public static readonly DependencyProperty PrefixesProperty = |
| 68 | + DependencyProperty.Register( |
| 69 | + nameof(Prefixes), |
| 70 | + typeof(string), |
| 71 | + typeof(RichSuggestBox), |
| 72 | + new PropertyMetadata("@", OnPrefixesChanged)); |
| 73 | + |
| 74 | + public string PlaceholderText |
| 75 | + { |
| 76 | + get => (string)GetValue(PlaceholderTextProperty); |
| 77 | + set => SetValue(PlaceholderTextProperty, value); |
| 78 | + } |
| 79 | + |
| 80 | + public Style RichEditBoxStyle |
| 81 | + { |
| 82 | + get => (Style)GetValue(RichEditBoxStyleProperty); |
| 83 | + set => SetValue(RichEditBoxStyleProperty, value); |
| 84 | + } |
| 85 | + |
| 86 | + public object Header |
| 87 | + { |
| 88 | + get => GetValue(HeaderProperty); |
| 89 | + set => SetValue(HeaderProperty, value); |
| 90 | + } |
| 91 | + |
| 92 | + public object Description |
| 93 | + { |
| 94 | + get => GetValue(DescriptionProperty); |
| 95 | + set => SetValue(DescriptionProperty, value); |
| 96 | + } |
| 97 | + |
| 98 | + public TextWrapping TextWrapping |
| 99 | + { |
| 100 | + get => (TextWrapping)GetValue(TextWrappingProperty); |
| 101 | + set => SetValue(TextWrappingProperty, value); |
| 102 | + } |
| 103 | + |
| 104 | + public RichEditClipboardFormat ClipboardCopyFormat |
| 105 | + { |
| 106 | + get => (RichEditClipboardFormat)GetValue(ClipboardCopyFormatProperty); |
| 107 | + set => SetValue(ClipboardCopyFormatProperty, value); |
| 108 | + } |
| 109 | + |
| 110 | + public SolidColorBrush SuggestionBackground |
| 111 | + { |
| 112 | + get => (SolidColorBrush)GetValue(SuggestionBackgroundProperty); |
| 113 | + set => SetValue(SuggestionBackgroundProperty, value); |
| 114 | + } |
| 115 | + |
| 116 | + public SolidColorBrush SuggestionForeground |
| 117 | + { |
| 118 | + get => (SolidColorBrush)GetValue(SuggestionForegroundProperty); |
| 119 | + set => SetValue(SuggestionForegroundProperty, value); |
| 120 | + } |
| 121 | + |
| 122 | + public string Prefixes |
| 123 | + { |
| 124 | + get => (string)GetValue(PrefixesProperty); |
| 125 | + set => SetValue(PrefixesProperty, value); |
| 126 | + } |
| 127 | + |
| 128 | + /// <summary> |
| 129 | + /// Gets object used for lock |
| 130 | + /// </summary> |
| 131 | + protected object LockObj { get; } |
| 132 | + |
| 133 | + public RichEditTextDocument TextDocument => _richEditBox?.TextDocument; |
| 134 | + |
| 135 | + public ReadOnlyObservableCollection<SuggestionInfo> Tokens { get; } |
| 136 | + } |
| 137 | +} |
0 commit comments