G
G
Georgy Kuznetsov2021-11-19 20:21:41
WPF
Georgy Kuznetsov, 2021-11-19 20:21:41

Is there such a property in xaml to bind to the property when the application starts?

Suppose there is such a property

public TCommand ReadDataBase
        {
            get
            {
                return new TCommand
                (
                    (obj) =>
                    {
                        UserList = DataBaseOperations.ReadDataBase();
                    }
                );
            }
        }


is there something in the xaml that could execute it on application startup?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LiptonOlolo, 2021-11-20
@JoeSmith3100

Do not make such saints.
Make St. like this:

public MyClass()
{
    MyCommand = new DelegateCommand(AnyAction);
}

public ICommand MyCommand {get;}

void AnyAction()
{
    //code
}

Then you can call the AnyAction method from the constructor, or get the ViewModel in the View and call MyCommand.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question