Пример #1
0
 private void InitializeBackgroundViews()
 {
     BackgroundViews.Clear();
     foreach (var background in UserData.Backgrounds)
     {
         InitializeBackgroundView(background);
     }
 }
Пример #2
0
        private void InitializeBackgroundView(BackgroundViewModel background)
        {
            var view = background.CreateTileView();

            background.Command          = SelectBackgroundCommand;
            background.CommandParameter = background;
            BackgroundViews.Add(view);
        }
Пример #3
0
 private void BackgroundsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (BackgroundViewModel background in e.NewItems)
         {
             var view = background.CreateTileView();
             background.Command          = SelectBackgroundCommand;
             background.CommandParameter = background;
             BackgroundViews.Add(view);
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (BackgroundViewModel background in e.OldItems)
         {
             var view = BackgroundViews.First(v => v.DataContext == background);
             BackgroundViews.Remove(view);
         }
     }
 }