namespace FeedbackGeneratorQQ.Utils
{
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
public static class ElementsGenerator
{
///
/// Creates a container for an attribute
///
/// Return a StackPanel container for an attribute
public static StackPanel CreateDefaultAttributeContainer()
{
return new StackPanel
{
Orientation = Orientation.Vertical,
Width = 150
};
}
///
/// Creates an attribute checkbox by the given attribute name
///
/// The attribute name
/// Returns attribute checkbox
public static CheckBox CreateDefaultAttributeCheckbox(string name)
{
return new CheckBox
{
Content = name.Length < 20 ? name : string.Concat(name.Substring(0, 20), "..."),
ToolTip = name,
Padding = new Thickness(4, -1, 0, 0),
Margin = new Thickness(4),
};
}
///
/// Creates an attribute type combobox with the given list of options
///
/// Options to select
/// Returns attribute type combobox
public static ComboBox CreateDefaultAttributeCombobox(List attributeTypes)
{
ComboBox combobox = new ComboBox
{
Width = 100,
HorizontalAlignment = HorizontalAlignment.Center,
DisplayMemberPath = "Key",
SelectedValuePath = "Value",
};
attributeTypes.ForEach(type => combobox.Items.Add(new KeyValuePair(type, type)));
return combobox;
}
}
}