In which @Captain writes his first WPF app, again



  • OK, I had tried to use WPF before, and XAML stumped me at the time. I got better.

    What's the easiest way to set up a CRUD system (including UI) over EF? Bonus points if it does Metro UI.



  • Dunno, is there a WPF version of the DataGridView control?



  • @Medinoc
    There's a System.Windows.Controls.DataGrid, which I think is the WPF equivalent. Not sure though as I haven't really done WPF before.

    Edit: Having said that, it might just be better to consult the WPF Data Binding guide.



  • @Captain said in In which @Captain writes his first WPF app, again:

    OK, I had tried to use WPF before, and XAML stumped me at the time. I got better.

    What's the easiest way to set up a CRUD system (including UI) over EF? Bonus points if it does Metro UI.

    WinRT and WPF are not compatible. They're similar, yes, in the sense that if you know how a WPF GridView works then you also know how the WinRT one works.

    But the entry points are different and they're also different namespaces.

    That's why, for example, I cannot use an API for my Physics measuring tools because the developer decided to plonk something from System.Drawing into the API for raisins, instead forcing me to talk to the devices directly over USB.



  • @Rhywden said in In which @Captain writes his first WPF app, again:

    WinRT and WPF are not compatible. They're similar, yes, in the sense that if you know how a WPF GridView works then you also know how the WinRT one works.

    People still use WinRT? I thought UWP had replaced it.



  • @powerlord said in In which @Captain writes his first WPF app, again:

    @Rhywden said in In which @Captain writes his first WPF app, again:

    WinRT and WPF are not compatible. They're similar, yes, in the sense that if you know how a WPF GridView works then you also know how the WinRT one works.

    People still use WinRT? I thought UWP had replaced it.

    The APIs are still labelled Windows Runtime, hence WinRT.



  • @Rhywden I thought Metro was just the "look" of the UI, as opposed to an API that made it. So while WinRT might default to Metro, I can make WPF look Metro with themes/styles/etc. (I'm using MahApps.Metro and Fluent.Ribbon with a Metro skin).

    Did I choose the wrong UI framework for my new application?

    Filed under: willing to admit my ignorance here



  • The latest fad seems to be to write everything in HTML+CSS+Javascript and to use Electron to make it into an app (like Atom and VS Code).



  • I guess my question is more about the approach than the technology. When I made a web-based MVVM CRUDish Dashboard SPA UI, it turned into a bit of a mess (probably because it was my first/second time doing it.)

    Is there a library I should use to handle CRUD controls and interaction? Or should I do it raw? CRUD just seems like it has to be a solved problem by now.


  • SockDev

    @Captain said in In which @Captain writes his first WPF app, again:

    Did I choose the wrong UI framework for my new application?

    depends. do you want to program with the latest fads, or just have an application that works?



  • @Captain said in In which @Captain writes his first WPF app, again:

    @Rhywden I thought Metro was just the "look" of the UI, as opposed to an API that made it. So while WinRT might default to Metro, I can make WPF look Metro with themes/styles/etc. (I'm using MahApps.Metro and Fluent.Ribbon with a Metro skin).

    Did I choose the wrong UI framework for my new application?

    Filed under: willing to admit my ignorance here

    Well, there certainly are packages to make WPF stuff look like it's ModernUI. But that's all 3rd party. The native stuff is not available - it's either-or.

    But I'm not quite sure what CRUD has to do with choosing WPF or WinRT.



  • @accalia I want it to work today and for at least the next 10 years. If WPF is obsolete (or will be soon) then the latter goal is harder to accomplish.

    @Rhywden not much, except that one or the other might have better libraries or controls (native or third party) that people might want to recommend.

    I've been reading around about WPF MVVM, and it looks like there just isn't any one standard approach. I guess I'll make a basic WPF MVVM app until I run into a problem.



  • @Captain If you're using a library like Prism (and either Unity or Autofac) then you could also use either WinRT or WPF.


  • SockDev

    @Captain said in In which @Captain writes his first WPF app, again:

    I want it to work today and for at least the next 10 years.

    good luck with that.

    we used to build graphics libraries to last, but these days it seems to be that we like to build them for a year, decide they were shit, then rewrite it without trying to fix why it was shit in the first place.


  • Winner of the 2016 Presidential Election

    @accalia said in In which @Captain writes his first WPF app, again:

    without trying to fix why it was shit in the first place.

    Well the problem was the name, obviously.



  • Great, now Visual Studio Designer won't show controls in my MainWindow.

    The designer seems to know the controls are there, though. Lines appear over the invisible controls, and follow the cursor's focus. Controls are also visible on other windows, just not MainWindow.

    I cleaned and rebuilt -- the app builds and the controls are visible.

    I don't get it.



  • @Captain said in In which @Captain writes his first WPF app, again:

    @accalia I want it to work today and for at least the next 10 years. If WPF is obsolete (or will be soon) then the latter goal is harder to accomplish.

    @Rhywden not much, except that one or the other might have better libraries or controls (native or third party) that people might want to recommend.

    I've been reading around about WPF MVVM, and it looks like there just isn't any one standard approach. I guess I'll make a basic WPF MVVM app until I run into a problem.

    Yeah... have fun with that. Considering we don't know what's going to be popular next year - much less 10 years from now.

    Consider a desktop application from 2006. Web application from 2006. A year before the first iPhone. Back when Blackberry and Palm were kings.

    Do you honestly think you'll create an app that will last 10 years?

    If you want something to last that long, pay more attention to the data - that's what will be important and will transcend WPF, javascript and whatever new flavors and buzzwords come out next year.


  • Winner of the 2016 Presidential Election

    @accalia said in In which @Captain writes his first WPF app, again:

    @Captain said in In which @Captain writes his first WPF app, again:

    Did I choose the wrong UI framework for my new application?

    depends. do you want to program with the latest fads, or just have an application that works?

    What are the answers to this? (in particular, what's the best for windows desktop apps from .net? Still WPF?)


  • SockDev

    @Dreikin said in In which @Captain writes his first WPF app, again:

    @accalia said in In which @Captain writes his first WPF app, again:

    @Captain said in In which @Captain writes his first WPF app, again:

    Did I choose the wrong UI framework for my new application?

    depends. do you want to program with the latest fads, or just have an application that works?

    What are the answers to this? (in particular, what's the best for windows desktop apps from .net? Still WPF?)

    hell if i know. i'm a serverside fox.



  • @Captain said in In which @Captain writes his first WPF app, again:

    @Rhywden I thought Metro was just the "look" of the UI, as opposed to an API that made it. So while WinRT might default to Metro, I can make WPF look Metro with themes/styles/etc. (I'm using MahApps.Metro and Fluent.Ribbon with a Metro skin).

    Did I choose the wrong UI framework for my new application?

    Filed under: willing to admit my ignorance here

    No

    All you have to do is throw it an object that has the column names as property names.

    Or you can bind columns to properties and name them yourself if you like spaces in your names.

    Maybe an attribute on the properties will do it though.



  • @Captain My personal trick to WPF/XAML development is to be the bamboo in the breeze. Question not why it does, simply go with the flow.

    Okay and maybe mumble under my breath, "Don't make me write this shit in Winforms you little shit. I'll do it and I know you can host the control you fucker!"



  • @Captain said in In which @Captain writes his first WPF app, again:

    @Rhywden I thought Metro was just the "look" of the UI, as opposed to an API that made it. So while WinRT might default to Metro, I can make WPF look Metro with themes/styles/etc. (I'm using MahApps.Metro and Fluent.Ribbon with a Metro skin).

    Did I choose the wrong UI framework for my new application?

    Filed under: willing to admit my ignorance here

    UWP gives you new APIs. Notifications in the Notification Center may be interesting. And it's easier to submit to the Store. If none of that matters it's up to you.



  • How do you keep getting tasks like that? It's like your employer is keeping you around just so they can snicker watching you try to deal with MS technology.


  • Impossible Mission Players - A

    @cartman82 said in In which @Captain writes his first WPF app, again:

    How do you keep getting tasks like that? It's like your employer is keeping you around just so they can snicker watching you try to deal with MS technology.

    No, he stated he was doing this for himself.

    @Captain said in In which @Captain writes his first WPF app, again: (Emphasis mine)

    Did I choose the wrong UI framework for my new application?

    (Though it's small so you might not be able to tell very well, I bolded I and My)



  • @cartman82 said in In which @Captain writes his first WPF app, again:

    How do you keep getting tasks like that? It's like your employer is keeping you around just so they can snicker watching you try to deal with MS technology.

    My job title is really long. Operations Manager and Program & Business Analyst.

    The task I'm working on is somewhat related to BA tasks, and since I do have previous programming experience (including with MVVM), it does make some sense for me to plan and implement. Even if that does mean learning.

    Also, I have a lot of IT operations tasks to deal with. It's a non-profit, and they need me around to either fix stuff or delegate.



  • @WernerCD said in In which @Captain writes his first WPF app, again:

    Do you honestly think you'll create an app that will last 10 years?

    My first alpha released on 12/28/2002. The UI layout hasn't changed much... Back then, it was C++/MFC. In 2009 it changed to C++/wxWidgets. Still is. (I only support Windows and Mac) I've been considering a WinStore version... Not sure it will actually ever happen...



  • @Captain I know quite a bit of WPF and general XAML stuff still. It will exist for the next 10 years pretty safely, so it's not a bad choice.

    Anyway, you want simple CRUD stuff? I'd start plain and simple, with at most MEF for composition, and some nice MVVM. I have a thread in here somewhere about that, but even as simple as it is, it's probably more than you need.

    Construct good, clear models, and datagrids will be pretty easy - custom columns complicate everything a lot, though. WPF has no free editable pivot grids, so if the need for one of those comes up, you're probably out of luck.

    As for UI style, you may be better leaving that alone. Maybe get a ribbon, but everything else will update as the windows theme updates, so as long as you don't template things, they will never look out of place. The system is there because it's sometimes needed, but the temptation to mess with that stuff overpowers a lot of people.

    Just try to keep it all simple. If you need to do UI validation, simple will be out the window, but for most other things, you should be fine.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.