icommand

silverlight commands via prism, getting the event args for the event?

I've a data form in SL3 which uses Prisms Commands with Attached Behaviour for trapping events. (It fairly tightly follows this blog post: http://blogs.southworks.net/dschenkelman/2009/04/18/commands-with-attached-behavior-for-silverlight-3-dataform/#comment-607) Basically, it's all hooked up and working fine, however in the viewmodel,...

WPF ICommand vs RoutedCommand

Let's have a button Command property bound to a custom command. When should I implement ICommand and when derive from RoutedCommand? I see that RoutedCommand implements ICommand. In which case could I need to iplement an ICommand? What about MVVM model? Which one suits better for this purpose? ...

MVVM (ICommand) in Silverlight

Hello! Please, don't judge strictly if this question was discussed previously or indirectly answered in huge nearby prism and mvvm blogs. In WPF implementation of RelayCommand or DelegateCommand classes there is a such eventhandler /// <summary> /// Occurs whenever the state of the application changes such that the result of ...

WPF ICommand MVVM implementation

So in this particular MVVM implementation I'm doing, I need several commands. I really got tired of implementing the ICommand classes one by one, so I came up with a solution, but I don't know how good it is, so the input of any WPF expert here will be greatly appreciated. And if you could provide a better solution, even better! What I ...

CommandManager.InvalidateRequerySuggested() isn't fast enough. What can I do?

Short Version Calls to CommandManager.InvalidateRequerySuggested() take far longer to take effect than I would like (1-2 second delay before UI controls become disabled). Long Version I have a system where I submit tasks to a background-thread based task processor. This submit happens on the WPF UI thread. When this submit happens, t...

WPF: How to make button (splitbutton) enabled when it's bound command cannot execute?

Hi, I am building a custom splitbutton that consists of two overlapping buttons, and popup - like this (image shows some generic splitbutton): My SplitButton opens popup whan a right side with arrow is clicked, and executes SplitButton.Command when a main button is clicked. In my case however sometimes the default action cannot execu...

Xamly begin a storyboard when a RoutedCommand is called?

Is there a way to begin a storyboard wen an ICommand is executed WITH XAML? ...

Adding MouseBindings to Items in a databound WPF ListView.

Hello, I'm trying to get a command in my ViewModel executed when the user clicks on a item in a ListView. When I add a ListViewItem in XAML I can just add a MouseBinding to its InputBindings. <ListView> <ListView.View> <GridView> <GridViewColumn Header="Test" /> </GridView> </ListView.View> <ListViewItem Content="Item...

ICommand _canExecute problem

Hi, I have the following code and it won't compile because the compiler cannot determine the return type of my CanExecute method. Can someone help me as to what is wrong? class ViewCommand : ICommand { #region ICommand Members public delegate Predicate<object> _canExecute(object param); private ICommand _E...

Commands in WPF, Implementation question

I know I've already asked questions on this, but something that's just confusing. I'm doing a tutorial on WPF MVVM pattern, but it seems I cannot get it right, as in the tutorial, it doesn't go into detail on how to implement the ICommand interface. (not sure how correct it really is?!!) I have the following implementation of ICommand:...

WPF: TreeViewItem bound to an ICommand

Hi All, I am busy creating my first MVVM application in WPF. Basically the problem I am having is that I have a TreeView (System.Windows.Controls.TreeView) which I have placed on my WPF Window, I have decide that I will bind to a ReadOnlyCollection of CommandViewModel items, and these items consist of a DisplayString, Tag and a Relay...

Is Josh Smith's implementation of the RelayCommand flawed?

Consider the reference article, specifically the example implementation of a RelayCommand (In Figure 3). (No need to read through the entire article for this question.) In general, I think the implementation is excellent, but I have a question about the delegation of CanExecuteChanged subscriptions to the CommandManager's RequerySugges...

Why can't I bind my Silverlight Button Click to a Prism DelegateCommand

I have a simple test app in Silverlight 3 and Prism where I'm just trying to bind a button Click to a simple command I have created on a view model. This is a test app just to get commanding working. When I run it I get a binding error telling me that the view cannot find the command: System.Windows.Data Error: BindingExpression path er...

Icommand in MVP

Does ICommand implementation in MVP (Model - View - Presenter) belong in Presenter or its own class? ...

WPF ICommand over a button

Hi, I have implemented a custom IComand class for one of my buttons. The button is placed in a page 'MyPage.xaml' but its custom ICommand class is placed in another class, not in the MyPage code behind. Then from XAML I want to bind the button with its custom command class and then I do: MyPage.xaml: <Page ...> <Page.Com...

WPF ViewModel Commands CanExecute issue

Hi all, I'm having some difficulty with Context Menu commands on my View Model. I'm implementing the ICommand interface for each command within the View Model, then creating a ContextMenu within the resources of the View (MainWindow), and using a CommandReference from the MVVMToolkit to access the current DataContext (ViewModel) Command...

Reuse controls inside a usercontrol

I have a UserControl UserControl1 and a button inside the UserControl1. And I have a UserControl1ViewModel that has an ICommand property for the button. Using this command I need to call a method outside(from other VMs or VM of the MainWindow) the VM. What is the best practice for this? ...

Binding command to button in silverlight 4 using mvvm

Hello, I have a user control called HomePage.xaml. I'm creating a model instance (using MVVM pattern) in the code behind file in the constructor of page as MainViewModel model = new MainViewModel(); I have a button in HomePage.xaml which I want to bind to the command inside MainViewModel called GetData() and want to populate the data...

How do I get the DropDown selection from a Command Button in ArcObjects?

I have a dropdown and a Icommand button in the same toolbar in ArcMap. I can't seem to get access to the dropdowns selection when I am using the command button. How can I find the dropdown so I can find out what the user just selected? Thanks Scott ...

Wpf usercontrol's Button not firing the ICommand in Presenter

I am new to WPF and tring to learn a WPF composite application. I have got user control which is a module which 1 label and 1 button on it. Now I am trying to use the Command property on button which looks like <Button Name="button1" Command="{Binding Path = GetCustomerNameCommand}">GetCustomer</Button> In the presenter I have got p...