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

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.

Related

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.

Is possible to change the default application icon in Xamarin forms cross portable platform app?

Is there a way to place the default application icon in the Portable component and save the annoying process of setting all the different resources for each platform?.
Having a cross platform App using Xamarin Forms in Visual Studio 2017, the solution have a Portable project and the Android, iOS and UWP specific projects.
There is no way to do this and I doubt if it ever will. At the end of the day you are still building an Android and iOS app which are still compiled through their own tools and compilers.
These tools expects app icons (amongst other things) to be in a certain format, at a certain place. The only thing you (or Xamarin) could do about that is to create it's own format for it and then generate the files in the right size, at the right place for you. I guess this is waaaaay low on the priority list, if it is on it at all. Also, thinking on how to do this, I also believe it is a tough process to get stable.
To help you create app icons in all the right dimensions, have a look at services like MakeAppIcon which help you a lot. Basically, you just copy and paste it into the right folders and you're done. But I doubt it will get any better than this anytime soon.

Having issues with OnPlatform selection for UWP in Xamarin.Forms Project

Good time of day to all. I am working on Xamarin.Forms project, including iOS, Android and UWP parts. My project requires usage of different custom fonts, accessible for all devices. So I added custom fonts and I am selecting them with
string fontName = Device.OnPlatform(
"RoundedLEDBoard-7",
"rounded_led_board-7.ttf#Rounded LED Board-7",
#"Assets\Fonts\rounded_led_board-7.ttf#Rounded LED Board-7");
Font names and locations are correct.
On the modeling stage I used a single page solution, to prototype some of the basic functionality. All worked exactly as expected on all three platforms, both emulators and real test devices. However, after adding navigation capabilities and changing App.xaml.cs from
MainPage = new Different_fonts.MainPage();
to
MainPage = new NavigationPage(new Different_fonts.MainPage());
I have discovered, that the font is not loaded (or displayed?) in UWP part of the project. Android and iOS parts look as expected. Complete re-build of the entire solution did not help. Does any one know where the problem is and what is the cure remedy?
It looks like you found quite an odd bug! I am also seeing this issue with a sample project using Forms 2.3.3. As you mentioned, iOS and Android don't experience this issue so this should work on UWP as well.
Unfortunately I don't have a workaround for this in the meantime, but I've filed a bug report so we can look into this.

Desktop Metro applications

I wonder how to create Zune-like apps (I mean Metro style). But I don't want them to be Windows Store apps (I have already installed Windows 8 platform with VS2012). Could you tell me if I should download some style pack or something like that? Maybe there are some libraries implementing Metro? If yes, plese make me know which one is the best.
Thanks in advance.
There is a Theme for WPF called Cosmopolitan that emulates the Metro style. Now it just gives you the flattened look on the controls for free. You're on your own with Layout, Animations, and Navigation.
Consider WPF UI framweork for building apps like zune
http://mahapps.com/MahApps.Metro/
Due to naming issues (read: MS didn't want to get sued and apparently couldn't properly trademark the word Metro, go figure) there is no such thing as Metro anymore.
That style was renamed to be "Windows Store". So I'm not 100% certain of what it is you are asking for.
Also, contrary to the name and potentially misleading marketing speak on their site, a Windows Store App does not have to be published and sold through the Windows Store.
You might read this for some "clarification":
http://www.zdnet.com/microsoft-finally-comes-cleaner-on-post-metro-naming-plans-7000004151/

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.

Categories

Resources