-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyPositionDataSource.cs
More file actions
56 lines (51 loc) · 1.24 KB
/
MyPositionDataSource.cs
File metadata and controls
56 lines (51 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.ComponentModel;
using System.Windows;
using Microsoft.Phone.Maps.Controls;
namespace Cyclestreets
{
public class MyPositionDataSource : INotifyPropertyChanged
{
private Map MyMap;
public MyPositionDataSource( Map MyMap )
{
// TODO: Complete member initialization
this.MyMap = MyMap;
MyMap.ZoomLevelChanged += MyMap_ZoomLevelChanged;
}
private void MyMap_ZoomLevelChanged( object sender, MapZoomLevelChangedEventArgs e )
{
Visible = _isVisible;
}
private Visibility _isVisible = Visibility.Visible;
public Visibility Visible
{
set
{
if( MyMap.ZoomLevel > 12 && _isVisible == Visibility.Collapsed )
{
_isVisible = Visibility.Visible;
NotifyPropertyChanged( @"Visible" );
}
else if( MyMap.ZoomLevel <= 12 && _isVisible == Visibility.Visible )
{
_isVisible = Visibility.Collapsed;
NotifyPropertyChanged( @"Visible" );
}
}
get
{
return _isVisible;
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged( String propertyName )
{
PropertyChangedEventHandler handler = PropertyChanged;
if( null != handler )
{
handler( this, new PropertyChangedEventArgs( propertyName ) );
}
}
}
}