Click here to Skip to main content
15,888,330 members
Home / Discussions / WPF
   

WPF

 
QuestionAdding Resources is giving errors not letting me add Resources Pin
indian14315-May-16 2:48
indian14315-May-16 2:48 
AnswerRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming16-May-16 1:21
mveRichard Deeming16-May-16 1:21 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 6:25
indian14316-May-16 6:25 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming16-May-16 6:28
mveRichard Deeming16-May-16 6:28 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 6:36
indian14316-May-16 6:36 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
indian14316-May-16 14:03
indian14316-May-16 14:03 
GeneralRe: Adding Resources is giving errors not letting me add Resources Pin
Richard Deeming17-May-16 1:02
mveRichard Deeming17-May-16 1:02 
QuestionPassing two parameters in Command biding in WPF and MVVM Pin
indian14315-May-16 1:27
indian14315-May-16 1:27 
Hi Friends,

I have two Textboxes, One for Id and another for the Name, I need to pass both of these two into MyViewModel class Id and Name Properties in a Button Click, so far I am able to pass one of them to the ViewModel, how can I pass both the parameters to the ViewModel, any help is greatly helpful. Thanks in advance please.
So far I am able to do as below
in View
<Button Content="Save" HorizontalAlignment="Left" Margin="277,142,0,0" VerticalAlignment="Top" Width="74" Name="btnSaveSpecific"
                Command="{Binding Path=TestSpecificCommand}"
                CommandParameter="{Binding ElementName=txtName, Path=Text}" />
In the Command class
public void Execute(object parameter)
       {
           var values = (string)parameter;

           this.ViewModel.AddAnItem(values);
       }
In View Model
public void AddAnItem(string _name)
{
    int t;

    if ((_personNames == null) || (_personNames.Count() <= 0))
        t = 1;
    else
        t = (_personNames.Count <= 0) ? 1 : _personNames.Max(x => x.Id) + 1;
    _personNames.Add(new TestData(t, _name));
}
I want to change this AddAnItem to take two parameters int and string and if possible return value also, but return is not important, what is important is to take two parameters. Please need help, any sort of help a link or code snippet or even a suggestion also helps.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 15-May-16 7:38am.

AnswerRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon15-May-16 8:15
mvePete O'Hanlon15-May-16 8:15 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14315-May-16 12:40
indian14315-May-16 12:40 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon15-May-16 19:33
mvePete O'Hanlon15-May-16 19:33 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 6:32
indian14316-May-16 6:32 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 7:05
mvePete O'Hanlon16-May-16 7:05 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 14:39
indian14316-May-16 14:39 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 20:47
mvePete O'Hanlon16-May-16 20:47 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
indian14316-May-16 22:08
indian14316-May-16 22:08 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Pete O'Hanlon16-May-16 22:11
mvePete O'Hanlon16-May-16 22:11 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Meshack Musundi23-May-16 3:12
professionalMeshack Musundi23-May-16 3:12 
QuestionAdd Dictionary in ObsavableCollection Pin
indian14314-May-16 9:20
indian14314-May-16 9:20 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Pete O'Hanlon14-May-16 22:07
mvePete O'Hanlon14-May-16 22:07 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Richard Deeming16-May-16 1:18
mveRichard Deeming16-May-16 1:18 
GeneralRe: Add Dictionary in ObsavableCollection Pin
indian14316-May-16 6:35
indian14316-May-16 6:35 
QuestionDatagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:02
indian14313-May-16 11:02 
AnswerRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
Richard Deeming13-May-16 11:16
mveRichard Deeming13-May-16 11:16 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:44
indian14313-May-16 11:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.