locked
Can I use C++/DirectX to achieve the same Modern UI style and navigation as C#/XAML?

    Question

  • Given a regular Modern UI style Windows 8 application that has multiple pages, grid views, content, data-binding to data from services like Azure Mobile Services, and so on

      

    Can I build the exact same app that looks and functions the same way using C++ (with DirectX for rendering some more complex stuff)?



    • Edited by Sal_S Wednesday, May 29, 2013 11:42 PM
    Wednesday, May 29, 2013 11:41 PM

Answers

  • Yes, you can implement all of the Xaml controls yourself in DirectX. This is typically done by apps with relatively simple UIs or using existing DirectX UI toolkits.

    Is this purely an academic question or do you have a real scenario in mind?

    If you want the Xaml functionality it will be much easier and more efficient to use the Xaml classes. As jrboddie suggests, you can interop between Xaml and DirectX to use the parts of each that your app needs.

    --Rob

    • Marked as answer by Sal_S Thursday, May 30, 2013 6:58 PM
    Thursday, May 30, 2013 1:21 AM
    Owner

All replies

  • Yes.  Easy using SurfaceImageSource and possible with a little more work using SwapChainBackGroundPanel.  See my reply to your post in the DirectX forum.
    Wednesday, May 29, 2013 11:51 PM
  • Actually I was thinking more in terms of pure C++ / DirectX (no XAML involved)

    Can you do away with XAML entirely and still achieve the same effect / functionality as a Modern UI app using only C++/DirectX


    • Edited by Sal_S Thursday, May 30, 2013 12:07 AM
    Thursday, May 30, 2013 12:03 AM
  • Yes, you can implement all of the Xaml controls yourself in DirectX. This is typically done by apps with relatively simple UIs or using existing DirectX UI toolkits.

    Is this purely an academic question or do you have a real scenario in mind?

    If you want the Xaml functionality it will be much easier and more efficient to use the Xaml classes. As jrboddie suggests, you can interop between Xaml and DirectX to use the parts of each that your app needs.

    --Rob

    • Marked as answer by Sal_S Thursday, May 30, 2013 6:58 PM
    Thursday, May 30, 2013 1:21 AM
    Owner
  • Yes, you can implement all of the Xaml controls yourself in DirectX. This is typically done by apps with relatively simple UIs or using existing DirectX UI toolkits.

    Is this purely an academic question or do you have a real scenario in mind?

    If you want the Xaml functionality it will be much easier and more efficient to use the Xaml classes. As jrboddie suggests, you can interop between Xaml and DirectX to use the parts of each that your app needs.

    --Rob


    I was only curious, thanks for your responses.
    Thursday, May 30, 2013 6:59 PM
  • Hi again Sal... I swear I'm not haunting you, your question is just the type I look for, so here we are again.

    Not to try to scare you, but control writing from scratch is either a full time job or at best a labor of love.  I've been writing controls before Microsoft existed, and let me impart one single observation that comes up again and again:  Control writing (from scratch) will dominate your work day.

    Whatever else cool you would like to do is going to be consumed in basic and edge-case control work.

    As before, I'm not saying it's a bad path (I've done it plenty of times, and am actually considering doing it again right now with a Desktop/DirectX app), I'm just saying that if you've never done it before, it's not nearly as easy as it would appear to be, and the amount of edge cases that crop up are frustrating.

    I hope this doesn't sound like doom and gloom... Sal... if your up for it, go for it, just letting you know this is one of the more time consuming parts of your endeavor.

    Jim

    Oh, let me add I'm not talking about maybe a few buttons, or simple dialogs.  I would definitely draw some 3D text for labeling 3D data, but don't discount XAML until you find a clear reason.

    • Edited by HeadRoach Friday, May 31, 2013 9:54 PM
    Friday, May 31, 2013 9:44 PM
  • Hi again Sal... I swear I'm not haunting you, your question is just the type I look for, so here we are again.

    Not to try to scare you, but control writing from scratch is either a full time job or at best a labor of love.  I've been writing controls before Microsoft existed, and let me impart one single observation that comes up again and again:  Control writing (from scratch) will dominate your work day.

    Whatever else cool you would like to do is going to be consumed in basic and edge-case control work.

    As before, I'm not saying it's a bad path (I've done it plenty of times, and am actually considering doing it again right now with a Desktop/DirectX app), I'm just saying that if you've never done it before, it's not nearly as easy as it would appear to be, and the amount of edge cases that crop up are frustrating.

    I hope this doesn't sound like doom and gloom... Sal... if your up for it, go for it, just letting you know this is one of the more time consuming parts of your endeavor.

    Jim

    Oh, let me add I'm not talking about maybe a few buttons, or simple dialogs.  I would definitely draw some 3D text for labeling 3D data, but don't discount XAML until you find a clear reason.

    I definitely want to reduce my workload so I'm all for the easy path, I wasn't really looking to do such a thing (unless it was something worthwhile and feasible), just curious if it was done anywhere or even possible. Thanks for adding your insight.
    Friday, May 31, 2013 10:09 PM
  • I have CAD package written in C# and wpf that I converted to a Win 8 C++ app.

    There were some gaping holes in Win 8 apps as far as user controls go.

    So I wrote my own dialogue boxes with lists and buttons.

    It wasn't too bad to write but took some time to get it right.

    I also wrote my own menu driver.

    MS took exception to my early attempts at it and I had to make sure it worked well with mouse and touch to pass certification.


    n.Wright



    Sunday, June 2, 2013 8:43 PM
  • Curious as to what the gaping holes were. Will soon be working on a C++ / DirectX project. Don't know yet whether it will be a Win 8 app, but don't want to rule it out.
    Tuesday, June 4, 2013 6:22 PM
  • Curious as to what the gaping holes were. Will soon be working on a C++ / DirectX project. Don't know yet whether it will be a Win 8 app, but don't want to rule it out.

    Win 8 apps lose menu bars, status bars and dialogue boxes.

    I had to write my own using direct2d.


    n.Wright

    Tuesday, June 4, 2013 8:11 PM