/// <summary> /// Selects the bus stop if neccessary. /// </summary> private void SetIsSelected(bool isSelected) { this.SetValue(Canvas.ZIndexProperty, (isSelected) ? 100 : 0); if (isSelected && this.headerControl == null) { this.headerControl = new BusStopHeaderControl(); this.headerControl.Margin = new Thickness(0, -55, 0, 0); this.headerControl.SetValue(Canvas.ZIndexProperty, 100); this.headerControl.SetStopName(this.viewModel.StopName); this.grid.Children.Add(this.headerControl); } else if (this.headerControl != null) { this.grid.Children.Remove(this.headerControl); this.headerControl = null; } }