public ScoreDistributionControl()
{
// Five columns, one for each star category RangeSlider
//ColumnDefinition col;
for (int i = 0; i < 5; i++)
{
AddColumn(20, GridUnitType.Star);
}
// Two rows, one for the header and one for the controls
AddRow(10, GridUnitType.Star);
AddRow(90, GridUnitType.Star);
// Control header
TextBlock text = new TextBlock();
text.Background = new SolidColorBrush(Colors.LightGray);
ToolTip tip = new ToolTip();
tip.Content = "Specify how the results should be distributed." + Environment.NewLine;
tip.Content += "For instance, if you set the one-star 'high' slider to 5%, it means that" + Environment.NewLine;
tip.Content += "the returned items will have no more than 5% one-star reviews.";
text.ToolTip = tip;
text.Foreground = new SolidColorBrush(Colors.Blue);
text.Text = "Result percentage ranges per star category";
text.TextAlignment = TextAlignment.Center;
AddContent(text, 0, 0, 5);
// Five range sliders; one for each star category
for (int i = 0; i < 5; i++)
{
RangeSliderX slider = new RangeSliderX();
slider.HeaderText = (i+1).ToString() + " - Star";
slider.High = 100;
slider.Low = 0;
slider.VerticalAlignment = VerticalAlignment.Stretch;
slider.HorizontalAlignment = HorizontalAlignment.Stretch;
_sliders[i] = slider;
//_sliders[i] = new RangeSliderX((i+1).ToString() + " - Star", new DoubleRange(0, 100))
//{
// VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
// HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
//};
_sliders[i].LowValueChanged += slider_LowValueChanged;
AddContent(_sliders[i], 1, i, 1);
}
}