Silverlight Games
Forum    Resources    Communities    New Posts    Windows 7 tools    Members   

Action Games | Sports Games | Puzzles | Kids Menu | Showcase | Show All
Bookmark and Share

My Profile
Active Members
Today
    Last 7 Days more...




    Forums » Silverlight Discussion Forum » General Development »

    Commands not being Invoked in my View Model Class.


    Posted Date: 29 Jul 2010      Posted By:: Debashish    Member Level: Bronze    Member Rank: 0     Points: 1   Responses: 0



    Hi , I am developing an MVVM Application. I am following the http://johnpapa.net/Silverlight/5-simple-steps-to-commanding-in-silverlight/

    I have a listBox showing all the Employee Names and beside it is the details of every employee.

    On click of a diffrent employee from the listBox we get the details of the Next Employee.

    I have also kept 4 Commands . But i am not sure why my commands in the VM is not getting called on click from View.

    --VIEW CLASS-------------------------------------------------------------------

    ItemsSource="{Binding Path=MinerList, Mode=TwoWay}"
    SelectedItem="{Binding Path=SelectedMiner, Mode=TwoWay}" >









    DataContext="{Binding Path=SelectedMiner, Mode=TwoWay}"
    Margin="5" Background="LightGray">









    ......









    .....




    ...


    --VIEW MODEL CLASS----------------------------------------------------------------------------------------------------------

    public ICommand SaveCommand { get; set; }

    In Constructor...

    public MinerMasterVM()
    {
    SaveCommand = new DelegateCommand(SaveMiner, CanSaveMiner);
    MinerServiceClient msClient = new MinerServiceClient();
    msClient.GetMinersCompleted += new EventHandler(msClient_GetMinersCompleted);
    msClient.GetMinersAsync();
    }

    public void SaveMiner(object parameter)
    {
    ....
    }

    void msClient_UpdateMinerCompleted(object sender, UpdateMinerCompletedEventArgs e)
    {
    throw new NotImplementedException();
    }

    private bool CanSaveMiner(object parameter)
    {
    return true;
    }

    -----------------------------------------------------------------------------------------------------

    I am calling the View XMAL file from the MainPage.XMAL.

    <

    views:MinerView x:Name="MinerDataView">

    MinerMasterVM mVM = new MinerMasterVM();

    MinerDataView.DataContext = mVM;



    All my VM objects are accessible . But not the Commands .
    Not sure Why . Can some body through some light on it.

    Regards

    Debashish





    Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Post Reply
    You must Sign In to post a response.
    Next : How do I add .CS functionality to XAML classes built in Expression Design?
    Return to Discussion Forum
    Post New Message
    Category: General Development

    Related Messages





    About Us    Contact Us    Privacy Policy    Terms Of Use