1

I have Add and Edit menuitems.

As of now there are two screens seperately which are AddProduct and EditProduct. So, based on command parameter, it is directly showing the screen but we want to change that and make those two as Single screen because it is using the same ViewModel

If user clicks on any of them, we are showing the same screen but with different inputs. Lets say, User clicks on Add, We are not loading any data to select existing products. Lets say, User clicks on Edit, we are loading the data into controls to select existing product.

I want to pass two parameters in CommandParameter differentiating the Add and Edit screens. Below is my xaml. How can I do this ?

  <telerik:RadMenuItem Header="Products" Name="Products" IconColumnWidth="0" >
      <telerik:RadMenuItem Header="Add" Name="AddProduct" IconColumnWidth="0" Command="{Binding ClickCommand}" CommandParameter="AddProduct"></telerik:RadMenuItem>
       <telerik:RadMenuItem Header="Edit" Name="EditProduct" IconColumnWidth="0" Command="{Binding ClickCommand}" CommandParameter="EditProduct"></telerik:RadMenuItem>
   </telerik:RadMenuItem>
Chatra
  • 2,989
  • 7
  • 40
  • 73
  • Why not have an AddCommand and an EditCommand? – Stephen Wilson Apr 24 '15 at 14:07
  • I don't see why you have to use just one command though. A ViewModel can have 2 commands that call 2 separate methods. One will be for adding and one for editing. Even with the way you have it and 1 command, just check what the string parameter is that you're passing to the command to decide whether to add or edit. Am I missing something here? – Stephen Wilson Apr 24 '15 at 15:02
  • @StephenWilson the data is getting loaded in constructor and constructor has params, so, We have to make sure the correct mode(add/Edit) is passing to constructor – Chatra Apr 24 '15 at 15:34

0 Answers0