Which framework should I use in Xamarin(.Forms) with OpenGL? - c#

We want to create an app, which works on multiple platforms showing a lot of lines and graphics. Since we have a Xamarin license and this app will not require any native look Xamarin.Forms is our choice. On the other hand we need mentioned graphics so we are thinking about using MonoGame (since we already know this framework). The only thing in here is, we would like to use some scrollviews in overlays and maybe the appbar (navigation bar on top). For this we had some problems in our test.
Now we are unsure what to use and would like to know if there are any other approaches to use Xamarin.Forms and OpenGL in parts.

Xamarin.Forms has a OpenGLView View and it can be used within a Xamarin.Forms page amongst other controls.
There is some examples, using Xamarin.Forms with this here.
Do note, however that this is only available in iOS and Android however.
Along with MonoGame, you have Urho which is mentioned on the Xamarin website that you may want to look into, link here. As to whether Urho is compatible with Xamarin.Forms I do not know.

Related

Why does the Xamarin.Forms designer not show windows layouts?

I tried searching for this everywhere, but I cannot find any solution.
I also tried looking at solution properties, project properties, visual studio preferences, Visual Studio extensions, change XAML xmlns definitions but I have no clue why this is not possible, and I think it should be standard simple functionality.
When you create a new Xamarin.Forms project that includes
, you would suspect that there is not only a way to see your XAML design on Android and iOS but also for any Windows platform you are targeting, such as W10 Desktop but also other Windows platforms that UWP supports and that supposedly Xamarin. Forms do support according to the website from Microsoft. You can easily build your project for these platforms, no problem. But I want to see what I am doing before I compile my work.
When opening your XAML design, instead of a simple Android / iOS and Windows tab in the design panel, Windows is nowhere to be found.
How am I supposed to see how my Windows screen is going to look without an option to see this? In WPF and plain UWP, this works fine, but somehow for Xamarin it only shows Android/IOS, but apparently, Xamarin has full support for Windows (desktop).
I am looking for multi-platform support to create a windows desktop application that is easily portable to iOS and Android. I thought Xamarin could do that, but if I am not able to see what I am doing on Windows in terms of layout, how am I supposed to develop a solid UI for the platform?
I am probably missing some kind of checkbox somewhere (I am hoping), but I cannot find any information about this. Yes, I tried to google. And Stack overflow. And Xamarin documentation from Microsoft. And watch YouTube videos about Xamarin for 20 minutes that supposed to explain the Xamarin multi-platform support. And after 20 minutes I find they only specifically explain iOS/Android but nothing about Windows. So yeah, getting pretty tired of searching and hope someone can be kind enough to help me out.
This is a limitation of Xamarin.Forms. Although it uses XAML, it has a custom XAML dialect which is not compatible with WPF/UWP, so the built-in UWP designer cannot handle it directly and it will require a custom designer implementation.
But if you want a first-class Windows development experience compatible with Android, iOS and even WebAssembly, try looking into the Uno Platform. This is a UWP bridge with full XAML compatibility with UWP XAML, so your app will look exactly the same on all platforms and provides full templating and styling support. In addition, Uno Platform provides bridge for many non-UI APIs as well, including things like Clipboard, Accelerometer and so on. In the end you will be able to just write a Windows app which will work everywhere with minimal changes.
You can use XAML adaptive triggers to make sure the app works well on each screen size and scales great from desktop to mobile.
If you want desktop version of you app just add UWP or WPF blank project to your solution.
For UWP it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/windows/installation/
For WPF it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf
Right click on your "Project.UWP" or "Project.WPF" project and pick "Set as Startup Project"
and building your solution.

Is there a designer for Xamarin xaml files?

I am currently starting an Xamarin Application. Now i wonder if there is any form of designer for the UI, so I do not have to start the application over and over again to test the UI while designing?
Unfortunately there is no designer.
The closest thing will be the Xamarin Live Player which is currently in Preview.
Another alternative is the Xaml Previewer for Xamarin.Forms
There are two tools used as said by cheddy - Gorilla Player and Live XAML. I have tried the gorilla player but it doesnot work for dot Net standards. then I found Live XAML which is a great live development toolalong with the XAML previewer. So I personally prefer to use Live XAML.
All those xamarin live player, live previewer, inspector, gorilla player are useless the more your app grows. maybe for basic, small apps and if you dont use any DI or 3rd party tools like from telerik or syncfusion and you have to do a lot of set ups, face with connection lost problems etc etc. Only fully working extension is LiveXaml extension which is unfortunately not free.
Good luck finding one. None of these work.

Using WPF dll's in UWP app

I'm writing a UWP app, and for some reason I'm unable to reference PresentationFramework.dll. It contains some WPF controls I want to use (specifically, System.Windows.Controls.DataGrid, but they aren't available under Universal Windows >> Extensions in the reference manager. Why is this, and how can I fix it?
TL;DR: You can't use WPF controls in UWP.
WPF and UWP are two totally different APIs with a different .NET framework. While WPF has access to the full .NET Framework, UWP has a much more limited API. If you want to read more on the different platforms and compilers, this msdn blog post is a good entry point.
You are thus unable to add any standard dlls as a reference to an UWP app. If you want to share code between WPF and UWP, you'll have to use a Portable Class Library, in which you target the platforms you need.
And as the XAML namespaces for WPF and UWP are different as well, you won't find many portable controls. So for UWP development you'll need to use UWP controls (equivalent to their WPF counterparts). Bonus tip: if you're looking for 3rd party controls, you can also look for 'winrt' controls as winrt was used for Windows 8/8.1, but it's the same technology.
I know this is an old question. Not even going to research what came out when. There is a DataGrid for UWP as part of the community toolkit:
https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/datagrid
It's really frustrating though, because it doesn't seem to do a few things that the WPF version does, and these are the few things I needed it do do.
Microsoft really needs to come up with a new naming conventions for its 114 different frameworks and platforms. Controls should be named DataGridWpf, DataGridUwp, etc.
It's super hard to search for examples of the UWP DataGrid control and find thousands of examples for the WPF version. Just my two cents. And for the record, it seems like there are about 5 active links to examples on the UWP version. Arrg.
/And for added fun, Telerik and DevExpress have UWP data grid controls, which they also call DataGrids.

How can I port my Windows Phone game to a Silverlight thing that I can use on a webpage?

I'm confused about how to port my WP7 C# game to the web using Silverlight.
I know that code written in C# using the Windows Phone (add-in? plugin? other?) for Visual Studio makes a Silverlight app. But how can I embed my finished WP7 app in a webpage?
I've seen some things such as ExEn, SilverSprite, and XnaTouch {the page redirects to MonoGame}, but I'm confused if I even need something like this in order to make my game playable on the web. I've got a feeling the capability may even be embedded in Visual Studio. Is it even possible to do this without rewriting all the code?
Shortened version: How can I port my WP7 C# game to the web using Silverlight?
Create a new project in Visual Studio targeting Silverlight beside your WP7 project. Then if your existing code is structured nicely, you should be able to re-use most of your "back-end" code (the views, viewmodels people talk of). The best way to do this for files that are common is to add them as links to the new project, so you don't have to keep them both up to date - if there are small changes between versions you can use conditional compilation to do this.
You'll want to use some completely new classes for some things, such as probably the top level view. Some XAML (eg a UserControl definition) might be usable between both with changes, though some people will favour always creating different versions. Have a look at this extensive article on cross-platform SL/WPF/WP7 development.
What have you tried?
If you create a Silverlight application in Visual Studio, you should be able to include all your existing Views, ViewModels, resources and so on. I don't know if you'll be able to make a single project that both builds into a WP7 and a Silverlight application but I personally wouldn't bother trying.
You can't directly - there are missing runtime components and features that are only available to Windows Phone applications.
You can, however, reuse lots of code, especially C# - all XAML code, I beleive, you'll have to copy/paste from WP7 XAML to Silverlight XAML.

How to use XNA in WPF?

So... I want to make a game, and I want to write it in C#. In the past, I've made a mario clone using C++ and OpenGL. I quite like OpenGL, but I don't know how well it's supported inside C#/WPF. Also, it might be beneficial to use an actual game library? I guess XNA is the game library for C#, so maybe I'll invest a bit of time learning that.
However, I want to use WPF form controls for my level editor... is there any way that I can embed an XNA (DirectX?) window inside a WPF app?
Specifically, I don't need any buttons or things inside the XNA/DirectX widget, just around it, so no mixing required...just need to get a graphics widget in my WPF form.
Nick Gravelyn explains how to do it on his blog.
Although, if it's just for an editor, you may find using WinForms is easier and better supported.
First of all, you should ask this on gamedev.stackexchange.com. But I've seen a tutorial embedding XNA.
You should check this question and this page. They are on Windows Forms, but they'll help.
Also check this and this articles.
Keep in mind one thing. XNA is meant to be used for the whole game, integration would be useful on making level editors like you say, but not for a full game.
WPF uses DirectX, and you can do direct "interop" here is a codeProject article on the subject. Here is an article i dug up where the author is using win-forms and WPF controls in an XNA project. Might be worth a look for you.

Categories

Resources