Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Open Dialog Fragment buy clicking a button

Hi

I've just started with Xamarin, and I'm wondering how I can open a dialog fragment by clicking a button. I've managed to do it using Events, but I'm trying to do it using bindings, which I do know how to do.

When I did it with Events I could do it like :

private void MNewThread_Click(object sender, EventArgs e)
{
FragmentTransaction transaction = FragmentManager.BeginTransaction();
Dialog_NewThread newThreadDialog = new Dialog_NewThread();
newThreadDialog.Show(transaction, "dialog fragment");

       // newThreadDialog.mOnSubmit += NewThreadDialog_mOnSubmit;
    }

and I'm trying to do something like

public ICommand NewThreadCommand { get; set; }

    public CommunityViewModel()  // This is the constructor 
    { 
        NewThreadCommand = new MvxCommand(() =>
        {
        //  Code to open the DialogFragment
        });

    }

Are there any simple solutions to this?

Thanks in advance

Tagged:
Sign In or Register to comment.