Prism Navigation is not working correctly - xamarin.forms

I just created a sample Android-XAMRIN project using Prism Template Pack. My base project in dot net standard 2.0 and I am using Prism.Unity.Forms 7.2.0.1367. While launching application it is showing blank page. I am attaching all images of project pages. AndroidProjProp.png
App_xaml App_xaml_cs
App_Proj_Prop MainActivity_cs MainPageViewModel Nuget_Installed ViewModelBase

You can follow Brian Lagunas's tutorial to create your app.
I followed his tutorial to createa a sample project, and run on my device, the result is showing a text Welcome to Xamarin Forms and Prism! .
The code of MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BlankApp2.Views.MainPage"
Title="{Binding Title}">
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Label Text="Welcome to Xamarin Forms and Prism!" />
</StackLayout>
</ContentPage>
Note
1.The difference is that we choose the value of container is Unity,just as follows:
Since it is a Xamarin Forms app,so we create user interfaces in XAML with code-behind in C#. and these interfaces are rendered as performant native controls on each platform. So the project pages is coded with format of XAML,not Activity(MainActivity) just as you mentioned.
For more information about Xamarin Forms, you can check: https://learn.microsoft.com/en-us/xamarin/get-started/what-is-xamarin-forms

Actually this was happening due to the current version of VS2017. I was using. I updated visual studio and it is working fine. Thanks

Related

ZXing and Xamarin

I've got a question for anyone who's worked with the ZXING barcode scanner in Xamarin.
I've got an app that has one page with the following code:
<zxing:ZXingScannerView x:Name="TicketScanView"
OnScanResult="Ticket_OnScanResult"
IsEnabled="False"
IsScanning="False"
WidthRequest="350"
HeightRequest="300"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"/>
Everything works great on Android and IPhone.
However when I add a second page with the same ZXing definition but change the name, the app runs on the iPhone and crashes on Android.
Any ideas/suggestions/input would be appreciated.
Thanks!

Uno Platform WASM results on a blank page

I'm studding Uno Platform and I have installed the UnoTemplates 2.4 version:
dotnet new -i Uno.ProjectTemplates.Dotnet::2.4
And created a new solution using:
dotnet new unoapp-prism –o UnoApp
The Shared project comes with a ContentControl named Shell:
But I added a Page named MainPage and updated the code on App.CreateShell():
sealed partial class App
{
...
protected override UIElement CreateShell()
{
return Container.Resolve<MainPage>();
}
...
}
When I try to run the Wasm project I just have a blank page on my browser.
Uno guides says that I need .Net Core 2.2, but I have the 3.1 on my PC that came when I installed VS2019. Could this be the problem? I don't want to uninstall the 3.1 version. Is there a way to install the 2.2 version and select which version to use?
It was rendering well. The problem was because I didn't set the Grid's Background. The TextBlock was white and I couldn't see it.
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
It's necessary to set the Background to all elements inside a Page. I added a Pivot inside a Page and I couldn't see even its Titles. When I set its Background, I figured out the problem.
<Pivot Title="Super Barato"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Thanks and I hope I helped others.

InitializeComponent not defined in current context- Xamarin Form

We are developing Shared Code based Xamarin Forms app to be deployed across Android and iOS platforms. We are facing this strange issue number of times. There is compile time error on InitializeComponent which didn't let code to compile. We have gone through almost all the stackoverflow questions and xamarin discussions on this topic. None to them helped.
Following is code-
DocumentSearchPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace FinderApp.Views
{
public partial class DocumentSearchPage : ContentPage
{
public DocumentSearchPage ()
{
InitializeComponent ();- This line show compilation issue- InitializeComponent doesn't exist in current context
}
}
}
DocumentSearchPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FinderApp.Views.DocumentSearchPage">
<ContentPage.Content>
</ContentPage.Content>
</ContentPage>
Till now we have tried-
Changing property custom tool to different values
Checking if Namespace names are matching in xaml and cs file
Updated xaml forms to v2.3.0.38 pre2. Obiviously we have tried with stable version first.
Clean Rebuild solution
Enviroment
iMac OS X 10.11.2
Xamarin Studio 5.10.3
Xamarin Forms 2.3.038 pre2
We are facing issue on windows8, visual studio 2015 also.\
We have this issue with PCL approach too.
Expert help needed!
If you are using VS 2015, seems naive but this is the state even as of today, no reasons to explain, but as of Aug 2016 and latest xamarin this is the status
Close and repoen solution
Clean Solution
Rebuild Solution

UWP app errors when built in .Net Native

We've got a Windows 8.1 app that we've converted to a Windows 10 UWP app. The app works fine in debug, but when running in Release (.Net Native), we are getting a runtime error on app load. It's not at all clear what's causing the error. The error happens in the OnLaunched event in App.xaml.cs where some data is being initialized. The error:
An exception of type System.NullReferenceException occurred in
System.Private.CoreLib.dll
Additional information: Arg_NullReferenceException
We're using the latest versions of MVVM Light.
I know this isn't a lot of info, but it's really all we have right now and are pretty stumped. Anyone seen and issue like this or know where to start in tracking it down?
If, you're still using SQLite or any Reference.
Please Right Click to your Project => Add => Reference => Make sure your DLL of Nuget is checked.
Please Check this solution.
I had this exact problem in that I converted an 8.1 app to UWP. This was resolved by including a file called Default.rd.xml in the Properties folder. This was not mentioned in the migration guide that I had used.
Not including it means some pretty common coding patterns such as reflection will not work, and this includes in imported .dll's.
A basic Default.rd.xml file looks like the following ...
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>
If this does not work, then try creating a new empty UWP project to get the latest format for the file.

What's the best idea to manage resources in Silverlight?

I need to create my silverlight framework that has all following features about resources.
Partial loading. So, I can't use sample resource file(*.resx).
Strongly-typed resource file. Because It's very easy to debug.
Easy to edit with sample text editor. Because you can't use some complex editor like visual studio in web server.
Easy to detect missing resources.
Hint
My framework is built on with Visual Studio Integration Package project. So, I can modify most of Visual Studio features like editor,toolbox, menu.
update#1
If it's impossible, So, I will create some resource edit on web server to manage this resource.
Thanks,
I'm not sure what you are trying to do as your question was rather vague, but I can shed some light on how resources can be managed on the Silverlight platform.
Silverlight resources can be embeded within any XAML as all visual elements have a ResourceDictionary which is accessible via the Resources property.
<Grid>
<Grid.Resources>
<DataTemplate x:Key="MyTemplate">
</DataTemplate>
</Grid.Resources>
</Grid>
However, it is best practice to use special XAML files called "Resource Dictionaries".
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<DataTemplate x:Key="MyTemplate">
</DataTemplate>
</ResourceDictionary>
Silverlight 3, brings the ability to automatically merge these resource dictionaries into the application's main resource dictionary.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/A.xaml"/>
<ResourceDictionary Source="Resources/B.xaml"/>
<ResourceDictionary Source="Resources/C.xaml"/>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Application.Resources>
In order to merge a resource dictionary with your Application's resources, the resource dictionaries must reside within the compressed XAP package that is used to deploy Silverlight applications down to the client.
However, if you wanted to, you could store the XAML resource dicationaries on the web server and bring them into your Silverlight application by using WebClient to download the file, then using XamlReader to construct the object model in memory from the XAML string you retrieve from the file.
Resource dictionaries are inherently strongly typed but not type-safe. In that, you will not get a compile time error if you have an improperly typed element in XAML. If there happens to be an error in one of your resources you will find out only when a reference to it is initialized and the rendering engine attempts to instantiate your resource.
So in short:
Yes.
Yes.
Yes.
No.

Resources