C# WPF open new window that displays the record that matches a unique ID.

I have a C# WPF datagrid displaying Work Orders from a SQL database view upon on which you select a row and click a select button (btnSelectWO)  The unique Work Order ID is then passed to a new window named EditWO as WONbr.  The datasource for the new window is a different than was used in the datagrid, CollectionViewSource tblMaintNotesViewSource.  My question is how can I filter or query the new window to show the record of the unique ID (WONbr) that has been passed to it so the user can modify the record?

I have set up this class but don't really understand what to do with it:
class WorkOrder
        {
            string Extruder { get; set; }
            string Shift { get; set; }
            string MaintNotes { get; set; }
            DateTime Date { get; set; }
            string Name { get; set; }
            int ID { get; set; }
            DateTime MaintDate { get; set; }
            string MainPerformed { get; set; }
            string MaintTech { get; set; }
            bool CloseOrder { get; set; }
            string AssignedTo { get; set; }
            string Instructions { get; set; }
        }

Open in new window


I'm new to C#, I've only been working with it for a few weeks.  I'm hoping this has to be pretty easy and straightforward, all I need is a kick in the right direction.

Thanks in advance for your help!
Jeff
Jeff HeilmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technical NinjaCommented:
Hi Jeff,

You are right. Once you get hang of it it is damn easy to build WPF apps(Compared to WinForms which dominated world for the larger part of .Net's existence).

If you don't mind can you tell me if you are learning from an online course? classroom? or on your own? Are you taking MVVM approach? if not, why not? would you like to go that route?

If you don't want to go to that route I can directly give you the answer as well but if learning is your core goal then please bear with me for couple of comments.

Regards,
Chinmay.
0
Jeff HeilmanAuthor Commented:
I've mostly been teaching myself with what I can find online.  I did take a week long online course a few weeks ago but honestly it was a little over my head at the time.  I worked in VBA for years and moved to C# because of an opportunity at work.  Truth be told I think the transition to C# would have been easier if I'd never have learned VBA.  I didn't realize how sloppy you can be with VBA and still have an application work.

I would like to take the MVVM approach, I have to learn it.

Thank you Chinmay!
0
Chinmay PatelChief Technical NinjaCommented:
Hi Jeff,

Though this is in context of MVVM I think you should give it a try: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/enterprise-application-patterns/mvvm to understand basics of MVVM.

And if you are ready to face a monster, read this : https://prismlibrary.github.io/docs/wpf/Implementing-MVVM.html. I dunno how but I am not able to locate this on docs.microsoft.com but it is there(somewhere).

Next step would be to choose a sample app to follow through. Let me know if you would want to jump right away OR after reading the above two (or even one will do as such) you have further questions, I can answer those questions and then take this forward.

Regards,
Chinmay.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Jeff HeilmanAuthor Commented:
OK, Thank you.
0
Jeff HeilmanAuthor Commented:
Thanks again Chinmay, I appreciate your time.
0
Chinmay PatelChief Technical NinjaCommented:
Hi Jeff,

Actually the answer is not complete yet. I was hoping you will come back after reading up on MVVM so we could take this process further. Learning MVVM with Prism is bit hard at the start but benefits of learning it with Prism (or for that matter any other framework out there) it makes things a lot easier.

I am of late developing a lot of prototypes in WPF and I am having a lot of fun and I was more than happy to explain it all here. I did not show you how to bind your model to your ViewModel and eventually View. If you figured it out in one day then it is awesome :). It took me some serious time before everything started to seem clear (maybe the old age is inching closer :P).

Anyways, all the best with your WPF journey and feel free to ask in case you run into any issues.

Regards,
Chinmay.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WPF

From novice to tech pro — start learning today.