Example #1
0
            public Context() {
                removeCommand = new RelayCommand(o => {
                    if (SelectedItem != null) {
                        findItemAndRemoveRecursively(Items, SelectedItem);
                    }
                }, o => {
                    return SelectedItem != null;
                });

                expandCollapseCommand = new RelayCommand(o => {
                    if (SelectedItem != null) {
                        SelectedItem.Expanded = !SelectedItem.Expanded;
                    }
                }, o => SelectedItem != null);

                changeTitleCommand = new RelayCommand( o => {
                    if ( SelectedItem != null ) {
                        SelectedItem.Title = "Changed title";
                    }
                }, o => SelectedItem != null );
            }
Example #2
0
 public DataContext( )
 {
     command = new RelayCommand(
         parameter => MessageBox.Show( "Information", "Command executed !", result => { } ),
         parameter => true );
 }