Hi,
Problem:
1. Assign collection to sparkline
2. Assign null to sparkline
3. Resize sparkline
Result:
Sparkline will show its state before assigning null to it.
Expected:
Sparkline should be empty.
XAML:
C#:
Sincerely, Alexey.
Problem:
1. Assign collection to sparkline
2. Assign null to sparkline
3. Resize sparkline
Result:
Sparkline will show its state before assigning null to it.
Expected:
Sparkline should be empty.
XAML:
Grid x:Name="LayoutRoot">
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Grid
x:Name
=
"_column"
SizeChanged
=
"_column_SizeChanged"
>
<
Controls:RadLinearSparkline
x:Name
=
"_Spark"
ShowMarkers
=
"True"
Height
=
"100"
Width
=
"100"
/>
</
Grid
>
<
Button
Content
=
"Button"
Height
=
"23"
HorizontalAlignment
=
"Left"
Margin
=
"45,12,0,0"
Name
=
"button1"
VerticalAlignment
=
"Top"
Width
=
"75"
Click
=
"button1_Click"
Grid.Column
=
"1"
/>
<
Button
Content
=
"Button"
Height
=
"23"
HorizontalAlignment
=
"Left"
Margin
=
"45,41,0,0"
Name
=
"button2"
VerticalAlignment
=
"Top"
Width
=
"75"
Click
=
"button2_Click"
Grid.Column
=
"1"
/>
<
sdk:GridSplitter
Name
=
"gridSplitter1"
VerticalAlignment
=
"Stretch"
HorizontalAlignment
=
"Right"
VerticalContentAlignment
=
"Stretch"
/>
</
Grid
>
C#:
public
partial
class
MainPage : UserControl
{
public
class
dataXY
{
public
dataXY(
double
x,
double
y) { X = x; Y = y; }
public
double
X {
get
;
set
; }
public
double
Y {
get
;
set
; }
}
private
ObservableCollection<dataXY> _data =
new
ObservableCollection<dataXY>();
public
MainPage()
{
InitializeComponent();
_Spark.XValuePath =
"X"
;
_Spark.YValuePath =
"Y"
;
Binding bind =
new
Binding();
bind.Source = _data;
bind.Mode = BindingMode.OneWay;
_Spark.ItemsSource = _data;
}
private
void
button1_Click(
object
sender, RoutedEventArgs e)
{
_data.Add(
new
dataXY(1, 0));
_data.Add(
new
dataXY(2, 1));
_data.Add(
new
dataXY(10, 2));
_data.Add(
new
dataXY(11, 3));
_data.Add(
new
dataXY(12, 2));
_data.Add(
new
dataXY(20, 1));
}
private
void
button2_Click(
object
sender, RoutedEventArgs e)
{
_Spark.ItemsSource =
null
;
}
private
void
_column_SizeChanged(
object
sender, SizeChangedEventArgs e)
{
_Spark.Width = _column.ActualWidth;
}
}
Sincerely, Alexey.