Exemplo n.º 1
0
        private void InitializeBackgroundView(BackgroundViewModel background)
        {
            var view = background.CreateTileView();

            background.Command          = SelectBackgroundCommand;
            background.CommandParameter = background;
            BackgroundViews.Add(view);
        }
Exemplo n.º 2
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);
         }
     }
 }