I swear, I can't believe there are no examples online (that are easy to find) that demonstrates this... I have to be searching wrong... Ok, here it is... the world's most complicated item to find online...
I have a textbox and a button. I press the button. Button runs SQL command to return data from a stored procedure to the grid control.
Example:
private void SbPatSrch_Click(object sender, RoutedEventArgs e)
{
var psm = new PatientSearchModel();
GcPatRslts.ItemsSource = psm.GridPopulate(TePatLname.Text);
}
PatientSearchModel is nothing more than C# connecting to the database and running the procedure and returning a data table. TePatLname.Text is the textbox that passes the parameter to the procedure.
Can anyone show me an example of how to do this in MVVM?
What I don't want is another example of a pre-built data table with all the columns and values defined. That's not what I want. That's not real-world. I can't load 1000's of records when the page opens. I need the user to provide values and let the procedure determine what is shown. I understand you likely can't share the database. That's fine. It doesn't have to work on my end. I just need to know that it works on your end. I need to see the pattern and understand the flow. I'm learning MVVM and so far, it just plain sucks. I hear it has great things to offer, but when I can use code behind and write two lines of code versus having files and files of view models and models, it seems like I'm going west until to get to the east side of the street...
What I have tried:
I've reached out to DevExpress and haven't heard back. I downloaded several examples online, but they are filled with garbage (pre-built data tables).