How to link XAML file to Xamarin.form Previewer - visual-studio

How do I connect XAML file to Xamarin.form Previewer
as you can see this XAML file not linked to previewer

As mentioned here, you will need to assign some static data to your view for the Previewer when using Bindings. You can do so by assigning a static data context. James Montemagno has already described how to do so here.
If that doesn't solve the issue at hand, then Xamarin is already aware that some issues may exist since the Previewer is still only in preview:
Project should be built (compiled) before attempting to preview XAML files.
The Designer Agent must be set-up the first time you preview a XAML file - a progress indicator will appear in the Previewer, along with progress messages, until this is ready.
Try closing and re-opening the XAML file.
If the solutions as mentioned above doesn't solve the issues you experience, I would recommend that you get in touch with Xamarin. As mentioned, the Previewer is still in preview, so issues may still exist.

Related

Looking for ways to edit Xamarin code on the run

This question could be split in 2:
is there any way to update xaml form markup in runtime and see the changes after re-entering the form? Similar to the way we can update asp.net pages in runtime
is there any way to update xaml.cs class in runtime? If I try, it shows me deceptive message
which is not true, as the change is small and compilable
Another strange thing displayed after that is the error in the Error List window
However project is already build on .net standard 2.1.0.0, and can see it in the project properties
XAML
Using XAML Hot Reload, it is possible to update your XAML during runtime and see the updates in real-time on the device/simulator.
C#
It is not currently possible to update and see your C# code changes during runtime.
The Xamarin engineering team is working on adding this feature and ou can follow their progress here: https://developercommunity.visualstudio.com/idea/650684/c-hot-reload-xamarin.html

How to display video and audio in HTML preview in Visual Studio Code

When I use the HTML5 video and audio tags in my code, video and audio appears when I load the file in a browser. They also appear when I use a HTML preview package in Atom, however, they appear greyed-out and are not interactive when I use Visual Studio Code and a HTML preview extension there.
At the bottom of the preview in Visual Studio Code, is a message:
Some content has been disabled in this document
When I hover over the message I see a tooltip
Potentially unsafe or insecure content has been disabled in the HTML Preview. Change the HTML preview security setting to allow insecure content or enable scripts.
I found the "HTML: Change Preview Security Settings" option in the Command Palette, however, changing the security settings caused no change. The video and audio are still greyed-out.
I'm new to Visual Studio Code and the preview not being an authentic version of what will be in the browser is annoying.
in Visual Studio Code
in Atom
Has anyone else come across this issue and does anyone know why this is?
I know it is a bit too late but had the same issue. The security settings menu appears in a very right hand corner of the main window and has 3 dots as an icon. Click on the menu to open html preview security options. See attached pix.
Disable the change preview settings.
You can put your file in your Visual Studio Code framework. Then it will work...
i faced the same problem today and after some research i got solution
Reasons why it's grayed may be due to following reason:
you wouldn't have the saved audio,image or video in the folder where your html code is saved.
Solution:
make sure to save your file(code) and data(audio,image or video) in same folder.
use live server for output.

Changing default XAML file for debugging

I am new to XAML development, i am currently writing and learning C#, but i am having a problems in switching default XAMl files for debugging. Is there an options to switch the default XAML files for debugging?
I've googled and try searching in stackoverflow, but i can't find any information regarding this.
The current green highlighted is the default XAML debugging files, i want to switch my main default XAMl files debugging to Login.xaml(highlighted in blue). Additional info for understanding, i am going to navigate to my main menu screen after my login. Thank you.

How can I fix this issue in Android Studio

After making a new project, I found that there is something wrong with Android Studio(I can't see the changes in design ), like adding widgets and the suggestion window doesn't appear, and the preview window shows an error(one or more layouts are missing the Layout_width or Layout_height, although, the two widgets which exist already have those attributes. The error is attached here:

Let a MainPage.cs create in Xamarin in Visual Studio

I am currently doing a visual studio xamarin course and I noticed that when, in the videos, a new Blank Forms App is created, the IDE creates an App.cs and MainPage.cs.
When I create one, the IDE creates a App.XAML with App.Xaml.cs and MainPage.XAML with MainPage.Xaml.cs.
XAML is where the design is done are XAML.CS where the logic is done or I am wright.
My question is, why or where come this change from? Why doesnt create XAML files in the course videos? An update or just a configuration difference?
This is just a difference in the templates provided in Visual Studio, when the video was shot, versus today.
It is up to you whether you create your view in the XAML file or not. However, it would be the usual place to design the UI. However, it is very opinion based, whether you should put any logic into the xaml.cs file. Some people would say you should follow the MVVM pattern and avoid putting anything but view and binding related stuff in it. Other people are more pragmatic and would allow logic to be put there.

Resources