Hi Eva,
thanks for the RangeBar, i am using it too. Maybe you can help me with the following issue:
I want to scale the RangeBar to five minutes with these lines:
MyRangeControl.Minimum = DateTime.Now;
MyRangeControl.Maximum = DateTime.Now + TimeSpan.FromMinutes(5);
Unfortunately, this code has no effect. I debugged the application and found out that minimum and maximum values are first set properly, but are overwritten a little later by this method:
private static void chart_Rendered(object sender, EventArgs e)
{
Chart chart = sender as Chart;
Grid contentGrid = (chart.Parent as Grid).Parent as Grid;
RangeBar rangeBar = contentGrid.Parent as RangeBar;
rangeBar.Dispatcher.BeginInvoke(new Action(delegate
{
rangeBar.PositionLeftAndRightThumb();
contentGrid.RowDefinitions[1].Height = new GridLength(chart.AxesX[0].Height, GridUnitType.Pixel);
rangeBar._renderBlock = true;
//These two lines will overwrite my values
rangeBar.Minimum = (DateTime)chart.AxesX[0].ActualAxisMinimum;
rangeBar.Maximum = (DateTime)chart.AxesX[0].ActualAxisMaximum;
rangeBar._renderBlock = false;
rangeBar.RenderLabels();
if (rangeBar.FromValue == null)
{
rangeBar.IsInternalValueSet = true;
rangeBar.FromValue = chart.AxesX[0].ActualAxisMinimum;
rangeBar.IsInternalValueSet = false;
if (rangeBar.RangeChanged != null)
rangeBar.RangeChanged(rangeBar, new RangeBarEventArgs()
{
IsFromValueChanged = true,
IsToValueChanged = false,
FromValue = rangeBar.FromValue
});
}
else
rangeBar.UpdateLeftThumbVisualAndUpdateFromValue();
if (rangeBar.ToValue == null)
{
rangeBar.IsInternalValueSet = true;
rangeBar.ToValue = chart.AxesX[0].ActualAxisMaximum;
rangeBar.IsInternalValueSet = false;
if (rangeBar.RangeChanged != null)
rangeBar.RangeChanged(rangeBar, new RangeBarEventArgs()
{
IsFromValueChanged = false,
IsToValueChanged = true,
ToValue = rangeBar.ToValue
});
}
else
rangeBar.UpdateRightThumbVisualAndUpdateToValue();
}));
rangeBar._chartRendered = true;
}
Is there any solution to this problem or am i doing something wrong?
Best regards,
maui