public ScalableTextBlock() { this.InitializeComponent(); this.proxy = new NavigationControllerProxy(); this.proxy.PropertyChanged += OnProxyPropertyChanged; this.Unloaded += (sender, args) => this.proxy.PropertyChanged -= OnProxyPropertyChanged; }
public ScalableTextBlock() { this.InitializeComponent(); this.proxy = new NavigationControllerProxy(); this.proxy.PropertyChanged += OnProxyPropertyChanged; this.Unloaded += (sender, args) => this.proxy.PropertyChanged -= OnProxyPropertyChanged; }
/// <summary> /// Creates the main page. /// </summary> public MainPage() { // The OBA app should only ever have one main page, and that should // always be this instance. NavigationController.Instance.MainPage = this; InitializeComponent(); this.proxy = (NavigationControllerProxy)this.Resources["navigationProxy"]; }
public BusStop() { this.InitializeComponent(); this.proxy = new NavigationControllerProxy(); // For perf reasons, we do as much of this in code as we can as it is faster than relying on the xaml // decompiler. This constructor is a hot path so we need to be smart about how we create it: // This binding hides / shows the control depending on how far the user has zoomed: Binding canvasVisibilityBinding = new Binding() { Path = new PropertyPath("MapView"), Converter = mapViewToVisibilityConverter, Source = this.proxy }; this.canvas.SetBinding(UIElement.VisibilityProperty, canvasVisibilityBinding); // Add the closest ellipse. When the view model is set we will // bind the visibility to it. this.closestEllipse = new Ellipse(); this.closestEllipse.Width = 40; this.closestEllipse.Height = 40; this.closestEllipse.Opacity = .5; this.closestEllipse.Margin = new Thickness(-20, -20, 0, 0); this.closestEllipse.Fill = redBrush; this.closestEllipse.Visibility = Visibility.Collapsed; this.canvas.Children.Add(this.closestEllipse); // Add the image: Image busImage = new Image(); busImage.Width = 28; busImage.Height = 28; busImage.Source = busBitmapImage; busImage.Margin = new Thickness(-14, -14, 0, 0); busImage.Tap += OnTap; this.canvas.Children.Add(busImage); this.Unloaded += OnUnloaded; }
public BusStop() { this.InitializeComponent(); this.proxy = new NavigationControllerProxy(); // For perf reasons, we do as much of this in code as we can as it is faster than relying on the xaml // decompiler. This constructor is a hot path so we need to be smart about how we create it: // This binding hides / shows the control depending on how far the user has zoomed: Binding canvasVisibilityBinding = new Binding() { Path = new PropertyPath("MapView"), Converter = mapViewToVisibilityConverter, Source = this.proxy }; this.canvas.SetBinding(UIElement.VisibilityProperty, canvasVisibilityBinding); // Add the closest ellipse. When the view model is set we will // bind the visibility to it. this.closestEllipse = new Ellipse(); this.closestEllipse.Width = 40; this.closestEllipse.Height = 40; this.closestEllipse.Opacity = .5; this.closestEllipse.Margin = new Thickness(-20, -20, 0, 0); this.closestEllipse.Fill = redBrush; this.closestEllipse.Visibility = Visibility.Collapsed; this.canvas.Children.Add(this.closestEllipse); // Add the image: Image busImage = new Image(); busImage.Width = 28; busImage.Height = 28; busImage.Source = busBitmapImage; busImage.Margin = new Thickness(-14, -14, 0, 0); busImage.PointerPressed += OnPointerPressed; this.canvas.Children.Add(busImage); this.Unloaded += OnUnloaded; }