File size: 1,912 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Microsoft.Management.UI.Internal
{
/// <summary>
/// Picker control that displays a list with basic editing functionality.
/// </summary>
[SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
public partial class ListOrganizer : ContentControl
{
/// <summary>
/// Creates a new instance of the ListOrganizer class.
/// </summary>
public ListOrganizer()
{
// empty
}
/// <summary>
/// Prevents keyboard focus from leaving the dropdown.
/// </summary>
/// <param name="e">The event args.</param>
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.Key == Key.Up ||
e.Key == Key.Down ||
e.Key == Key.Left ||
e.Key == Key.Right)
{
e.Handled = true;
}
}
partial void OnSelectItemExecutedImplementation(ExecutedRoutedEventArgs e)
{
if (e.Parameter == null)
{
throw new ArgumentException("e.Parameter is null", "e");
}
this.RaiseEvent(new DataRoutedEventArgs<object>(e.Parameter, ItemSelectedEvent));
this.picker.IsOpen = false;
}
partial void OnDeleteItemExecutedImplementation(ExecutedRoutedEventArgs e)
{
if (e.Parameter == null)
{
throw new ArgumentException("e.Parameter is null", "e");
}
this.RaiseEvent(new DataRoutedEventArgs<object>(e.Parameter, ItemDeletedEvent));
}
}
}
|