public void SetStops(params BusStop[] stops)
 {
     Stops = stops.ToArray();
     //scrollViewer.HorizontalScrollBarVisibility = stops.Length == 1 ? ScrollBarVisibility.Hidden : ScrollBarVisibility.Auto;
     //scrollViewer.HorizontalScrollMode = stops.Length == 1 ? ScrollMode.Disabled : ScrollMode.Enabled;
     if (SingleStopControl != null)
         SingleStopControl.Children.Clear();
     if (ItemsPanel != null)
         ItemsPanel.Children.Clear();
     foreach (BusStop stop in stops)
     {
         StopArrivalsBox box = new StopArrivalsBox() { Stop = stop };
         if (stops.Length == 1)
         {
             //Binding sizeBinding = new Binding() { Source = SingleStopControl, Path = new PropertyPath("ActualWidth"), Mode = BindingMode.OneWay };
             //box.SetBinding(FrameworkElement.WidthProperty, sizeBinding);
             LoadInnerGrid();
             SingleStopControl.Children.Add(box);
         }
         else
         {
             box.Width = 285;
             LoadInnerScrollViewer();
             ItemsPanel.Children.Add(box);
         }
     }
 }
Пример #2
0
 public void SetStops(params BusStop[] stops)
 {
     Stops = stops.ToArray();
     //scrollViewer.HorizontalScrollBarVisibility = stops.Length == 1 ? ScrollBarVisibility.Hidden : ScrollBarVisibility.Auto;
     //scrollViewer.HorizontalScrollMode = stops.Length == 1 ? ScrollMode.Disabled : ScrollMode.Enabled;
     if (SingleStopControl != null)
     {
         SingleStopControl.Children.Clear();
     }
     if (ItemsPanel != null)
     {
         ItemsPanel.Children.Clear();
     }
     foreach (BusStop stop in stops)
     {
         StopArrivalsBox box = new StopArrivalsBox()
         {
             Stop = stop
         };
         if (stops.Length == 1)
         {
             //Binding sizeBinding = new Binding() { Source = SingleStopControl, Path = new PropertyPath("ActualWidth"), Mode = BindingMode.OneWay };
             //box.SetBinding(FrameworkElement.WidthProperty, sizeBinding);
             LoadInnerGrid();
             SingleStopControl.Children.Add(box);
         }
         else
         {
             box.Width = 285;
             LoadInnerScrollViewer();
             ItemsPanel.Children.Add(box);
         }
     }
 }
Пример #3
0
        private async static void OnStopChangedStatic(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            StopArrivalsBox typedSender = (StopArrivalsBox)sender;
            BusStop         value       = (BusStop)e.NewValue;

            typedSender.NameBlock.Text        = value.Name;
            typedSender.DirectionImage.Source = new BitmapImage(new Uri(value.Direction == StopDirection.Unspecified ? "ms-appx:///Assets/Icons/BusBase20.png" : "ms-appx:///Assets/Icons/BusDirection" + value.Direction.ToString() + "20.png"));
            await typedSender.RefreshArrivals(false);
        }