Пример #1
0
        protected override void SetSldControl()
        {
            SControl.Height = (short)SldHeight;
            SControl.Style  = (int)SldStyle;

            if (SldItems != null && SldItems.Count > 0)
            {
                SControl.AddItems(SldItems.ToArray());
            }
            else if (!string.IsNullOrWhiteSpace(StartUpItems))
            {
                SldItems = new ObservableCollection <string>(StartUpItems.Split(','));
            }
        }
Пример #2
0
 private void OnSldItemsPropertyChanged(ObservableCollection <string> oldValue, ObservableCollection <string> newValue)
 {
     if (oldValue != null)
     {
         oldValue.CollectionChanged -= SldItems_CollectionChanged;
     }
     if (newValue != null)
     {
         if (SControl != null)
         {
             SControl.AddItems(newValue.ToArray());
         }
         newValue.CollectionChanged += SldItems_CollectionChanged;
     }
 }
Пример #3
0
 private void SldItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (SControl == null)
     {
         return;
     }
     if (e.OldItems != null)
     {
         for (int i = e.OldStartingIndex; i < e.OldItems.Count; i++)
         {
             SControl.DeleteItem((short)i);
         }
     }
     if (e.NewItems != null &&
         e.NewItems.Count > 0)
     {
         SControl.AddItems(e.NewItems.Cast <string>().ToArray());
     }
     if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         SControl.Clear();
     }
 }