Skip to content

Instantly share code, notes, and snippets.

@TinkerWorX
Created February 18, 2018 12:19
Show Gist options
  • Save TinkerWorX/c3c38b393bdf04ff5ed192d94c34ba2d to your computer and use it in GitHub Desktop.
Save TinkerWorX/c3c38b393bdf04ff5ed192d94c34ba2d to your computer and use it in GitHub Desktop.
using GS1.Xml;
using Serilog;
using System.Windows;
using System.Windows.Controls;
namespace SimpleData.Windows.DesktopClient.Controls
{
public partial class GlobalProductClassificationSelector
{
public static readonly DependencyProperty SelectedSegmentProperty = DependencyProperty.Register(nameof(SelectedSegment), typeof(Segment), typeof(GlobalProductClassificationSelector));
public static readonly DependencyProperty SelectedFamilyProperty = DependencyProperty.Register(nameof(SelectedFamily), typeof(Family), typeof(GlobalProductClassificationSelector));
public static readonly DependencyProperty SelectedClassProperty = DependencyProperty.Register(nameof(SelectedClass), typeof(Class), typeof(GlobalProductClassificationSelector));
public static readonly DependencyProperty SelectedBrickProperty = DependencyProperty.Register(nameof(SelectedBrick), typeof(Brick), typeof(GlobalProductClassificationSelector));
public GlobalProductClassificationSelector()
{
this.InitializeComponent();
}
public Segment SelectedSegment
{
get => (Segment)this.GetValue(SelectedSegmentProperty);
set => this.SetValue(SelectedSegmentProperty, value);
}
public Family SelectedFamily
{
get => (Family)this.GetValue(SelectedFamilyProperty);
set => this.SetValue(SelectedFamilyProperty, value);
}
public Class SelectedClass
{
get => (Class)this.GetValue(SelectedClassProperty);
set => this.SetValue(SelectedClassProperty, value);
}
public Brick SelectedBrick
{
get => (Brick)this.GetValue(SelectedBrickProperty);
set => this.SetValue(SelectedBrickProperty, value);
}
private void SegmentComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.SelectedSegment = this.SegmentComboBox.SelectedValue as Segment;
Log.Information("Segment selected: {segment}", this.SelectedSegment?.Text);
}
private void FamilyComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.SelectedFamily = this.FamilyComboBox.SelectedValue as Family;
Log.Information("Segment selected: {family}", this.SelectedFamily?.Text);
}
private void ClassComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.SelectedClass = this.ClassComboBox.SelectedValue as Class;
Log.Information("Segment selected: {class}", this.SelectedClass?.Text);
}
private void BrickComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.SelectedBrick = this.BrickComboBox.SelectedValue as Brick;
Log.Information("Segment selected: {brick}", this.SelectedBrick?.Text);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment