28 lines
981 B
C#
28 lines
981 B
C#
using bts.api;
|
|
using bts.spark;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace mbts.ui.controls {
|
|
public class SparkMenu : ItemsControl {
|
|
static SparkMenu() =>
|
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(SparkMenu), new FrameworkPropertyMetadata(typeof(SparkMenu)));
|
|
|
|
public SparkMenu() {
|
|
SetCurrentValue(FocusableProperty, false);
|
|
}
|
|
|
|
|
|
public SparkMenu(IEnumerable<SparkCommand> commands, IBus bus) : this() =>
|
|
ItemsSource = commands.Select(c => new SparkCommandVM(c, bus)).ToList();
|
|
|
|
public bool ShowText {
|
|
get { return (bool)GetValue(ShowTextProperty); }
|
|
set { SetValue(ShowTextProperty, value); }
|
|
}
|
|
public static readonly DependencyProperty ShowTextProperty =
|
|
DependencyProperty.Register("ShowText", typeof(bool), typeof(SparkMenu), new PropertyMetadata(true));
|
|
}
|
|
} |