I created a button and wrote its behaviour to clear the scatter view, but it didnt work:
private void Button1_Click(object sender, RoutedEventArgs e)
{
DependencyObject parent = VisualTreeHelper.GetParent(this);
ScatterViewItem svi = null;
while (parent as ScatterView == null)
{
if (parent is ScatterViewItem)
svi = parent as ScatterViewItem;
parent = VisualTreeHelper.GetParent(parent);
}
((ScatterView)parent).Items.Remove(svi);
}
Before this, I thought to reset the application by this code which didnt work either: (I added using System.Diagnostics; )
private void Button1_Click(object sender, RoutedEventArgs e)
{
Process.Start(Application.ResourceAssembly.Location);
Application.Current.Shutdown();
}
the xaml:
<s:SurfaceButton Content="Clear" Name="Button1" Click="Button1_Click" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
can you tell me what i miss, thanks
You can simply give the ScatterView
a name
<s:ScatterView x:Name="scatterView" ... />
and then access it from code behind:
private void Button1_Click(object sender, RoutedEventArgs e)
{
scatterView.Items.Clear();
}