committed by
GitHub
13 changed files with 4433 additions and 6 deletions
@ -0,0 +1,59 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui"> |
|||
<StackPanel Orientation="Vertical" Gap="4"> |
|||
<TextBlock Classes="h1">AutoCompleteBox</TextBlock> |
|||
<TextBlock Classes="h2">A control into which the user can input text</TextBlock> |
|||
|
|||
<StackPanel Orientation="Horizontal" |
|||
Margin="0,16,0,0" |
|||
HorizontalAlignment="Center" |
|||
Gap="8"> |
|||
<StackPanel Orientation="Vertical"> |
|||
<TextBlock Text="MinimumPrefixLength: 1"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
MinimumPrefixLength="1"/> |
|||
<TextBlock Text="MinimumPrefixLength: 3"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
MinimumPrefixLength="3"/> |
|||
<TextBlock Text="MinimumPopulateDelay: 1 Second"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
MinimumPopulateDelay="1"/> |
|||
<TextBlock Text="MaxDropDownHeight: 60"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
MaxDropDownHeight="60"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
Watermark="Watermark"/> |
|||
<TextBlock Text="Disabled"/> |
|||
<AutoCompleteBox Width="200" |
|||
IsEnabled="False"/> |
|||
</StackPanel> |
|||
|
|||
|
|||
<StackPanel Orientation="Vertical"> |
|||
|
|||
<TextBlock Text="ValueMemeberSelector"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
ValueMemberSelector="Capital"/> |
|||
<TextBlock Text="ValueMemberBinding"/> |
|||
<AutoCompleteBox Width="200" |
|||
Margin="0,0,0,8" |
|||
ValueMemberBinding="{Binding Capital}"/> |
|||
<TextBlock Text="Multi-Binding"/> |
|||
<AutoCompleteBox Name="MultiBindingBox" |
|||
Width="200" |
|||
Margin="0,0,0,8" |
|||
FilterMode="Contains"/> |
|||
<TextBlock Text="Async Populate"/> |
|||
<AutoCompleteBox Name="AsyncBox" |
|||
Width="200" |
|||
Margin="0,0,0,8" |
|||
FilterMode="None"/> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,143 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.LogicalTree; |
|||
using Avalonia.Markup; |
|||
using Avalonia.Markup.Xaml; |
|||
using Avalonia.Markup.Xaml.Data; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class AutoCompleteBoxPage : UserControl |
|||
{ |
|||
public class StateData |
|||
{ |
|||
public string Name { get; private set; } |
|||
public string Abbreviation { get; private set; } |
|||
public string Capital { get; private set; } |
|||
|
|||
public StateData(string name, string abbreviatoin, string capital) |
|||
{ |
|||
Name = name; |
|||
Abbreviation = abbreviatoin; |
|||
Capital = capital; |
|||
} |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return Name; |
|||
} |
|||
} |
|||
|
|||
private StateData[] BuildAllStates() |
|||
{ |
|||
return new StateData[] |
|||
{ |
|||
new StateData("Alabama","AL","Montgomery"), |
|||
new StateData("Alaska","AK","Juneau"), |
|||
new StateData("Arizona","AZ","Phoenix"), |
|||
new StateData("Arkansas","AR","Little Rock"), |
|||
new StateData("California","CA","Sacramento"), |
|||
new StateData("Colorado","CO","Denver"), |
|||
new StateData("Connecticut","CT","Hartford"), |
|||
new StateData("Delaware","DE","Dover"), |
|||
new StateData("Florida","FL","Tallahassee"), |
|||
new StateData("Georgia","GA","Atlanta"), |
|||
new StateData("Hawaii","HI","Honolulu"), |
|||
new StateData("Idaho","ID","Boise"), |
|||
new StateData("Illinois","IL","Springfield"), |
|||
new StateData("Indiana","IN","Indianapolis"), |
|||
new StateData("Iowa","IA","Des Moines"), |
|||
new StateData("Kansas","KS","Topeka"), |
|||
new StateData("Kentucky","KY","Frankfort"), |
|||
new StateData("Louisiana","LA","Baton Rouge"), |
|||
new StateData("Maine","ME","Augusta"), |
|||
new StateData("Maryland","MD","Annapolis"), |
|||
new StateData("Massachusetts","MA","Boston"), |
|||
new StateData("Michigan","MI","Lansing"), |
|||
new StateData("Minnesota","MN","St. Paul"), |
|||
new StateData("Mississippi","MS","Jackson"), |
|||
new StateData("Missouri","MO","Jefferson City"), |
|||
new StateData("Montana","MT","Helena"), |
|||
new StateData("Nebraska","NE","Lincoln"), |
|||
new StateData("Nevada","NV","Carson City"), |
|||
new StateData("New Hampshire","NH","Concord"), |
|||
new StateData("New Jersey","NJ","Trenton"), |
|||
new StateData("New Mexico","NM","Santa Fe"), |
|||
new StateData("New York","NY","Albany"), |
|||
new StateData("North Carolina","NC","Raleigh"), |
|||
new StateData("North Dakota","ND","Bismarck"), |
|||
new StateData("Ohio","OH","Columbus"), |
|||
new StateData("Oklahoma","OK","Oklahoma City"), |
|||
new StateData("Oregon","OR","Salem"), |
|||
new StateData("Pennsylvania","PA","Harrisburg"), |
|||
new StateData("Rhode Island","RI","Providence"), |
|||
new StateData("South Carolina","SC","Columbia"), |
|||
new StateData("South Dakota","SD","Pierre"), |
|||
new StateData("Tennessee","TN","Nashville"), |
|||
new StateData("Texas","TX","Austin"), |
|||
new StateData("Utah","UT","Salt Lake City"), |
|||
new StateData("Vermont","VT","Montpelier"), |
|||
new StateData("Virginia","VA","Richmond"), |
|||
new StateData("Washington","WA","Olympia"), |
|||
new StateData("West Virginia","WV","Charleston"), |
|||
new StateData("Wisconsin","WI","Madison"), |
|||
new StateData("Wyoming","WY","Cheyenne"), |
|||
}; |
|||
} |
|||
public StateData[] States { get; private set; } |
|||
|
|||
public AutoCompleteBoxPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
|
|||
States = BuildAllStates(); |
|||
|
|||
foreach (AutoCompleteBox box in GetAllAutoCompleteBox()) |
|||
{ |
|||
box.Items = States; |
|||
} |
|||
|
|||
var converter = new FuncMultiValueConverter<string, string>(parts => |
|||
{ |
|||
return String.Format("{0} ({1})", parts.ToArray()); |
|||
}); |
|||
var binding = new MultiBinding { Converter = converter }; |
|||
binding.Bindings.Add(new Binding("Name")); |
|||
binding.Bindings.Add(new Binding("Abbreviation")); |
|||
|
|||
var multibindingBox = this.FindControl<AutoCompleteBox>("MultiBindingBox"); |
|||
multibindingBox.ValueMemberBinding = binding; |
|||
|
|||
var asyncBox = this.FindControl<AutoCompleteBox>("AsyncBox"); |
|||
asyncBox.AsyncPopulator = PopulateAsync; |
|||
} |
|||
private IEnumerable<AutoCompleteBox> GetAllAutoCompleteBox() |
|||
{ |
|||
return |
|||
this.GetLogicalDescendants() |
|||
.OfType<AutoCompleteBox>(); |
|||
} |
|||
|
|||
private bool StringContains(string str, string query) |
|||
{ |
|||
return str.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0; |
|||
} |
|||
private async Task<IEnumerable<object>> PopulateAsync(string searchText, CancellationToken cancellationToken) |
|||
{ |
|||
await Task.Delay(TimeSpan.FromSeconds(1.5), cancellationToken); |
|||
|
|||
return |
|||
States.Where(data => StringContains(data.Name, searchText) || StringContains(data.Capital, searchText)) |
|||
.ToList(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,64 @@ |
|||
// (c) Copyright Microsoft Corporation.
|
|||
// This source is subject to the Microsoft Public License (Ms-PL).
|
|||
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
|
|||
// All other rights reserved.
|
|||
|
|||
using System; |
|||
using System.Collections; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Input; |
|||
|
|||
namespace Avalonia.Controls.Utils |
|||
{ |
|||
/// <summary>
|
|||
/// Defines an item collection, selection members, and key handling for the
|
|||
/// selection adapter contained in the drop-down portion of an
|
|||
/// <see cref="T:Avalonia.Controls.AutoCompleteBox" /> control.
|
|||
/// </summary>
|
|||
public interface ISelectionAdapter |
|||
{ |
|||
/// <summary>
|
|||
/// Gets or sets the selected item.
|
|||
/// </summary>
|
|||
/// <value>The currently selected item.</value>
|
|||
object SelectedItem { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Occurs when the
|
|||
/// <see cref="P:Avalonia.Controls.Utils.ISelectionAdapter.SelectedItem" />
|
|||
/// property value changes.
|
|||
/// </summary>
|
|||
event EventHandler<SelectionChangedEventArgs> SelectionChanged; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets a collection that is used to generate content for the
|
|||
/// selection adapter.
|
|||
/// </summary>
|
|||
/// <value>The collection that is used to generate content for the
|
|||
/// selection adapter.</value>
|
|||
IEnumerable Items { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Occurs when a selected item is not cancelled and is committed as the
|
|||
/// selected item.
|
|||
/// </summary>
|
|||
event EventHandler<RoutedEventArgs> Commit; |
|||
|
|||
/// <summary>
|
|||
/// Occurs when a selection has been canceled.
|
|||
/// </summary>
|
|||
event EventHandler<RoutedEventArgs> Cancel; |
|||
|
|||
/// <summary>
|
|||
/// Provides handling for the
|
|||
/// <see cref="E:Avalonia.Input.InputElement.KeyDown" /> event that occurs
|
|||
/// when a key is pressed while the drop-down portion of the
|
|||
/// <see cref="T:Avalonia.Controls.AutoCompleteBox" /> has focus.
|
|||
/// </summary>
|
|||
/// <param name="e">A <see cref="T:Avalonia.Input.KeyEventArgs" />
|
|||
/// that contains data about the
|
|||
/// <see cref="E:Avalonia.Input.InputElement.KeyDown" /> event.</param>
|
|||
void HandleKeyDown(KeyEventArgs e); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,342 @@ |
|||
// (c) Copyright Microsoft Corporation.
|
|||
// This source is subject to the Microsoft Public License (Ms-PL).
|
|||
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
|
|||
// All other rights reserved.
|
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Avalonia.Controls.Primitives; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Input; |
|||
using Avalonia.LogicalTree; |
|||
using System.Collections; |
|||
using System.Diagnostics; |
|||
|
|||
namespace Avalonia.Controls.Utils |
|||
{ |
|||
/// <summary>
|
|||
/// Represents the selection adapter contained in the drop-down portion of
|
|||
/// an <see cref="T:Avalonia.Controls.AutoCompleteBox" /> control.
|
|||
/// </summary>
|
|||
public class SelectingItemsControlSelectionAdapter : ISelectionAdapter |
|||
{ |
|||
/// <summary>
|
|||
/// The SelectingItemsControl instance.
|
|||
/// </summary>
|
|||
private SelectingItemsControl _selector; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets a value indicating whether the selection change event
|
|||
/// should not be fired.
|
|||
/// </summary>
|
|||
private bool IgnoringSelectionChanged { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the underlying
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.
|
|||
/// </summary>
|
|||
/// <value>The underlying
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.</value>
|
|||
public SelectingItemsControl SelectorControl |
|||
{ |
|||
get { return _selector; } |
|||
|
|||
set |
|||
{ |
|||
if (_selector != null) |
|||
{ |
|||
_selector.SelectionChanged -= OnSelectionChanged; |
|||
_selector.PointerReleased -= OnSelectorPointerReleased; |
|||
} |
|||
|
|||
_selector = value; |
|||
|
|||
if (_selector != null) |
|||
{ |
|||
_selector.SelectionChanged += OnSelectionChanged; |
|||
_selector.PointerReleased += OnSelectorPointerReleased; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Occurs when the
|
|||
/// <see cref="P:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapter.SelectedItem" />
|
|||
/// property value changes.
|
|||
/// </summary>
|
|||
public event EventHandler<SelectionChangedEventArgs> SelectionChanged; |
|||
|
|||
/// <summary>
|
|||
/// Occurs when an item is selected and is committed to the underlying
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.
|
|||
/// </summary>
|
|||
public event EventHandler<RoutedEventArgs> Commit; |
|||
|
|||
/// <summary>
|
|||
/// Occurs when a selection is canceled before it is committed.
|
|||
/// </summary>
|
|||
public event EventHandler<RoutedEventArgs> Cancel; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the
|
|||
/// <see cref="T:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapter" />
|
|||
/// class.
|
|||
/// </summary>
|
|||
public SelectingItemsControlSelectionAdapter() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the
|
|||
/// <see cref="T:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapterr" />
|
|||
/// class with the specified
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.
|
|||
/// </summary>
|
|||
/// <param name="selector">The
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" /> control
|
|||
/// to wrap as a
|
|||
/// <see cref="T:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapter" />.</param>
|
|||
public SelectingItemsControlSelectionAdapter(SelectingItemsControl selector) |
|||
{ |
|||
SelectorControl = selector; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the selected item of the selection adapter.
|
|||
/// </summary>
|
|||
/// <value>The selected item of the underlying selection adapter.</value>
|
|||
public object SelectedItem |
|||
{ |
|||
get |
|||
{ |
|||
return SelectorControl?.SelectedItem; |
|||
} |
|||
|
|||
set |
|||
{ |
|||
IgnoringSelectionChanged = true; |
|||
if (SelectorControl != null) |
|||
{ |
|||
SelectorControl.SelectedItem = value; |
|||
} |
|||
|
|||
// Attempt to reset the scroll viewer's position
|
|||
if (value == null) |
|||
{ |
|||
ResetScrollViewer(); |
|||
} |
|||
|
|||
IgnoringSelectionChanged = false; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets a collection that is used to generate the content of
|
|||
/// the selection adapter.
|
|||
/// </summary>
|
|||
/// <value>The collection used to generate content for the selection
|
|||
/// adapter.</value>
|
|||
public IEnumerable Items |
|||
{ |
|||
get |
|||
{ |
|||
return SelectorControl?.Items; |
|||
} |
|||
set |
|||
{ |
|||
if (SelectorControl != null) |
|||
{ |
|||
SelectorControl.Items = value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// If the control contains a ScrollViewer, this will reset the viewer
|
|||
/// to be scrolled to the top.
|
|||
/// </summary>
|
|||
private void ResetScrollViewer() |
|||
{ |
|||
if (SelectorControl != null) |
|||
{ |
|||
ScrollViewer sv = SelectorControl.GetLogicalDescendants().OfType<ScrollViewer>().FirstOrDefault(); |
|||
if (sv != null) |
|||
{ |
|||
sv.Offset = new Vector(0, 0); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Handles the mouse left button up event on the selector control.
|
|||
/// </summary>
|
|||
/// <param name="sender">The source object.</param>
|
|||
/// <param name="e">The event data.</param>
|
|||
private void OnSelectorPointerReleased(object sender, PointerReleasedEventArgs e) |
|||
{ |
|||
if (e.MouseButton == MouseButton.Left) |
|||
{ |
|||
OnCommit(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Handles the SelectionChanged event on the SelectingItemsControl control.
|
|||
/// </summary>
|
|||
/// <param name="sender">The source object.</param>
|
|||
/// <param name="e">The selection changed event data.</param>
|
|||
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) |
|||
{ |
|||
if (IgnoringSelectionChanged) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
SelectionChanged?.Invoke(sender, e); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Increments the
|
|||
/// <see cref="P:Avalonia.Controls.Primitives.SelectingItemsControl.SelectedIndex" />
|
|||
/// property of the underlying
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.
|
|||
/// </summary>
|
|||
protected void SelectedIndexIncrement() |
|||
{ |
|||
if (SelectorControl != null) |
|||
{ |
|||
SelectorControl.SelectedIndex = SelectorControl.SelectedIndex + 1 >= SelectorControl.ItemCount ? -1 : SelectorControl.SelectedIndex + 1; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Decrements the
|
|||
/// <see cref="P:Avalonia.Controls.Primitives.SelectingItemsControl.SelectedIndex" />
|
|||
/// property of the underlying
|
|||
/// <see cref="T:Avalonia.Controls.Primitives.SelectingItemsControl" />
|
|||
/// control.
|
|||
/// </summary>
|
|||
protected void SelectedIndexDecrement() |
|||
{ |
|||
if (SelectorControl != null) |
|||
{ |
|||
int index = SelectorControl.SelectedIndex; |
|||
if (index >= 0) |
|||
{ |
|||
SelectorControl.SelectedIndex--; |
|||
} |
|||
else if (index == -1) |
|||
{ |
|||
SelectorControl.SelectedIndex = SelectorControl.ItemCount - 1; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Provides handling for the
|
|||
/// <see cref="E:Avalonia.Input.InputElement.KeyDown" /> event that occurs
|
|||
/// when a key is pressed while the drop-down portion of the
|
|||
/// <see cref="T:Avalonia.Controls.AutoCompleteBox" /> has focus.
|
|||
/// </summary>
|
|||
/// <param name="e">A <see cref="T:Avalonia.Input.KeyEventArgs" />
|
|||
/// that contains data about the
|
|||
/// <see cref="E:Avalonia.Input.InputElement.KeyDown" /> event.</param>
|
|||
public void HandleKeyDown(KeyEventArgs e) |
|||
{ |
|||
switch (e.Key) |
|||
{ |
|||
case Key.Enter: |
|||
OnCommit(); |
|||
e.Handled = true; |
|||
break; |
|||
|
|||
case Key.Up: |
|||
SelectedIndexDecrement(); |
|||
e.Handled = true; |
|||
break; |
|||
|
|||
case Key.Down: |
|||
if ((e.Modifiers & InputModifiers.Alt) == InputModifiers.None) |
|||
{ |
|||
SelectedIndexIncrement(); |
|||
e.Handled = true; |
|||
} |
|||
break; |
|||
|
|||
case Key.Escape: |
|||
OnCancel(); |
|||
e.Handled = true; |
|||
break; |
|||
|
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Raises the
|
|||
/// <see cref="E:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapter.Commit" />
|
|||
/// event.
|
|||
/// </summary>
|
|||
protected virtual void OnCommit() |
|||
{ |
|||
OnCommit(this, new RoutedEventArgs()); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Fires the Commit event.
|
|||
/// </summary>
|
|||
/// <param name="sender">The source object.</param>
|
|||
/// <param name="e">The event data.</param>
|
|||
private void OnCommit(object sender, RoutedEventArgs e) |
|||
{ |
|||
Commit?.Invoke(sender, e); |
|||
|
|||
AfterAdapterAction(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Raises the
|
|||
/// <see cref="E:Avalonia.Controls.Utils.SelectingItemsControlSelectionAdapter.Cancel" />
|
|||
/// event.
|
|||
/// </summary>
|
|||
protected virtual void OnCancel() |
|||
{ |
|||
OnCancel(this, new RoutedEventArgs()); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Fires the Cancel event.
|
|||
/// </summary>
|
|||
/// <param name="sender">The source object.</param>
|
|||
/// <param name="e">The event data.</param>
|
|||
private void OnCancel(object sender, RoutedEventArgs e) |
|||
{ |
|||
Cancel?.Invoke(sender, e); |
|||
|
|||
AfterAdapterAction(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Change the selection after the actions are complete.
|
|||
/// </summary>
|
|||
private void AfterAdapterAction() |
|||
{ |
|||
IgnoringSelectionChanged = true; |
|||
if (SelectorControl != null) |
|||
{ |
|||
SelectorControl.SelectedItem = null; |
|||
SelectorControl.SelectedIndex = -1; |
|||
} |
|||
IgnoringSelectionChanged = false; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
<Styles xmlns="https://github.com/avaloniaui"> |
|||
<Style Selector="AutoCompleteBox"> |
|||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> |
|||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
|||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> |
|||
<Setter Property="Padding" Value="4"/> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Panel> |
|||
<TextBox Name="PART_TextBox" |
|||
Background="{TemplateBinding Background}" |
|||
BorderBrush="{TemplateBinding BorderBrush}" |
|||
BorderThickness="{TemplateBinding BorderThickness}" |
|||
Padding="{TemplateBinding Padding}" |
|||
Watermark="{TemplateBinding Watermark}" |
|||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" /> |
|||
|
|||
<Popup Name="PART_Popup" |
|||
MinWidth="{TemplateBinding Bounds.Width}" |
|||
MaxHeight="{TemplateBinding MaxDropDownHeight}" |
|||
PlacementTarget="{TemplateBinding}" |
|||
StaysOpen="False"> |
|||
<Border BorderBrush="{DynamicResource ThemeBorderMidBrush}" |
|||
BorderThickness="1"> |
|||
<ListBox Name="PART_SelectingItemsControl" |
|||
BorderThickness="0" |
|||
Background="{TemplateBinding Background}" |
|||
Foreground="{TemplateBinding Foreground}" |
|||
ItemTemplate="{TemplateBinding ItemTemplate}" |
|||
MemberSelector="{TemplateBinding ValueMemberSelector}" |
|||
ScrollViewer.HorizontalScrollBarVisibility="Auto" |
|||
ScrollViewer.VerticalScrollBarVisibility="Auto" /> |
|||
</Border> |
|||
</Popup> |
|||
</Panel> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style Selector="AutoCompleteBox ListBoxItem:pointerover"> |
|||
<Setter Property="Background" Value="#ffd0d0d0"/> |
|||
</Style> |
|||
</Styles> |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue