Beispiel #1
0
        public void SetModel(WatchListPresentationModel model)
        {
            this.DataContext = model;

            // Because in Silverlight you cannot bind to a RelativeSource, we are using Resources with an observable value,
            // in order to be able to bind to the Buy and Sell commands.
            // The resources are declared in the XAML, because Silverlight has StaticResource markup only, so these
            // resources should be available when the control is initializing, even though the Value is yet not set.
            Binding binding = new Binding("RemoveWatchCommand");

            binding.Source = this.DataContext;
            ((ObservableCommand)this.Resources["RemoveWatchCommand"]).SetBinding(ObservableCommand.ValueProperty, binding);
        }
Beispiel #2
0
 public void SetModel(WatchListPresentationModel model)
 {
     this.DataContext = model;
 }