47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
using System.Windows;
|
|
using System.Windows.Documents;
|
|
using BeWo.Annotations;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.View.Controls
|
|
{
|
|
public partial class ListboxSelectControl
|
|
{
|
|
public event Action CancelButtonClicked;
|
|
public event Action SelectButtonClicked;
|
|
|
|
public ListboxSelectControl(List<object> items)
|
|
{
|
|
InitializeComponent();
|
|
|
|
if (!items.Any()) throw new ArgumentOutOfRangeException();
|
|
Listbox.ItemsSource = items;
|
|
Listbox.SelectedItem = items.First();
|
|
}
|
|
|
|
public List<object> Items => Listbox.ItemsSource as List<object>;
|
|
|
|
public object SelectedItem => Listbox.SelectedItem;
|
|
|
|
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
CancelButtonClicked?.Invoke();
|
|
}
|
|
|
|
private void SelectButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
SelectButtonClicked?.Invoke();
|
|
}
|
|
}
|
|
}
|