SelectionTool in C# | WPF | Saatody | Amit Padhiyar
SelectionTool is used for array group selection like select odd values or select even values from particular numbers range. This also select groups like 2, 3, 4, 1 etc...
SelectionTool Class API
SelectionTool class is main class of SelectionTool. This class provides rich options to select all, deselect all, select left half, select right half, select left half from already selected values, select right half from already selected values. Add custom group selection using 'Add' button.
Properties
Here in SelectionTool class has only two properties. The 'Range' used to define 'from value' to 'to value'. The 'SelectedRange' gives list of selected values from 'Range' value.
Syntax
public Range Range
public List<int> SelectedRange
Constructors
This is one and default constructor.
Syntax
public SelectionTool()
Events
Here only one event 'SelectedRangeChanged' which fire when selected range changed from any source. For examples: Select all, half select, group select.
Syntax
public event EventHandler SelectedRangeChanged;
ItemsControl Class API
ItemsControl is custom GUI class of groups list to add, remove, move up, move down, and select group to/from custom groups list range.
Properties
Here only one property which is SelectedItem and this property used when you want get selected custom group.
Syntax
public ItemsControlItem SelectedItem
Constructors
This is one and default constructor.
Syntax
public ItemsControl()
Methods
Here is only one non-static method which is used to get all groups value. And other four are static methods which are used for select group item, move up and move down group item, and at last remove group item from list.
Syntax
public List<int> GetGroupsValue()
public static void SelectItem(ItemsControl ItemsControl, ItemsControlItem ItemsControlItem)
public static void MoveUpItem(ItemsControl ItemsControl, ItemsControlItem ItemsControlItem)
public static void MoveDownItem(ItemsControl ItemsControl, ItemsControlItem ItemsControlItem)
public static void RemoveItem(ItemsControl ItemsControl, ItemsControlItem ItemsControlItem)
Events
The event 'SelectedItemChanged' which fire when selected item changed from custom groups list (means this class).
Syntax
public event EventHandler SelectedItemChanged;
ItemsControlItem Class API
This class only stores group value and specially used for item layout like select, move up, move down and remove group's buttons.
Properties
The 'ItemsControl' property hold ItemsControlItem's owned ItemsControl object. And GroupValue stores group value in integer form and show value on Label.
Syntax
public ItemsControl ItemsControl { set; get; }
public int GroupValue
Constructors
This is one and default constructor.
Syntax
public ItemsControlItem()
Range Class API
The 'Range' class stores minimum and maximum values in integer variables via default constructor with two perameters (minimum and maximum).
Properties
Here in this class there is only two properties available and both properties are get properties. It means properties can only return value and can't set values in those properties.
Syntax
public int Minimum
public int Maximum
Constructors
This is one and default constructor with two integer parameters to set minimum and maximum values as a one and final way to the properties value.
Syntax
public Range(int Minimum, int Maximum)
Example Of Selection Tool
XAML (.xaml)
<gui:SelectionTool x:Name="ST"/>
C# (.cs)
ST.Range = new Range(0, 100);
ST.SelectedRangeChanged += (sender, e) =>
{
string RangeValues = "Range: ";
foreach (int Range in ST.SelectedRange)
{
RangeValues += Range + ", ";
}
System.Console.WriteLine(RangeValues);
};
Comments
Post a Comment