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.
Related
I just upgraded my android studio at 3.6.3 version and I started to watch some Udemy course about Kotlin programming and I noticed when I tried to create new Fragment I didn't see a checkbox "include interface callbacks" as in old version in Android studio.
I am a beginner in Kotlin so I need some advice.
Here is an example of fragment creation in the new Android studio:
Here is in some old version:
How can I include interface callbacks in the new version of the Android studio automatically?
I hope I don't need to do it all manually, maybe some shortcut option?
I investigated and I found out that interface callbacks for communication between fragments and fragments with activity are now maintained with the use of ViewModel class which is much easier than using all that code with interface callbacks.
Second good option for such communication is the use of third-party libraries like RxJava.
Means guys from Google and JetBrains removed that option and now is available option to create ViewModel class within Fragment through File -> New -> Fragment -> Fragment(with ViewModel).
I upgraded to Xamarin.Forms 4.2. For Android, it crashed immediately after launch.
The error message is
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
After tracing through the code, the app has launched and there is no code left to execute. Then, it crashed.
Thanks Lucas. As suggested, in SplashActivity.cs, change the class declaration to
public class SplashActivity : global::Android.Support.V7.App.AppCompatActivity
I have my UWP Application inherited from Base class, which inherits from MvxApplication<Setup, CoreApp>:
public sealed partial class App : WindowsApplication
{
public App()
{
InitializeComponent();
}
}
public class WindowsApplication : MvxApplication<Setup, CoreApp>
{
}
public class Setup : MvxWindowsSetup<CoreApp>
{
public override IEnumerable<Assembly> GetViewAssemblies()
{
// need to do this as otherwise I receive the message that corresponding view to view model is not found
var assemblies = base.GetViewAssemblies().ToList();
assemblies.Add(typeof(Forms.App).Assembly);
return assemblies;
}
}
However, when launching it, receiving the following error message:
The type MvxContentPagePresentationAttribute is not configured in the
presenter dictionary
As I understand, all that is not proper way to launch Xamarin.Forms MvvmCross application, as UWP App and Setup should be inherited from something like MvxFormsApplication and MvxFormsWindowsSetup<CoreApp, Forms.App> respectively (to have Xamarin.Forms app properly initialized).
But:
MvxFormsApplication is not generic and doesn't provide ability of passing Forms-generic setup.
even if I inherit the App from MvxFormsApplication and use this.RegisterSetupType<MvxFormsWindowsSetupInheritor>();, Visual Studio compiler never allows me to compile the project because of some weird error message (something like The name “WindowsApplication” does not exist in the namespace “…”) (this might be some issue of Visual Studio, but I have VS 15.7 version, which expects the code to work (again, MvvmCross declares they support UWP and XF)).
So, from my understanding, if there is Xamarin.Forms app, there must be also some way of passing actually Xamarin.Forms App class to the UWP App class initialization.
MvvmCross, again, stands for UWP and Xamarin.Forms support, but I can't see any clear example of the way to setup such type of application.
MvvmCross documentation as always is quite "modest". There are some instructions about setting up MvvmCross UWP app as well as setting up MvvmCross XF iOS/Android, but the only word about MvvmCross XF UWP is:
You are now free to place your custom renderers in a different
assembly. All you have to do to make it work is to add your assembly
to the Setup.ViewAssemblies collection.
(in official website docs)
(which is still sounds weird, as iOS and Android versions don't need that additional code, which makes me think that such (current) documentation isn't quite actualized)
and
UWP, WPF
Extend App from MvxApplication. ( App : MvxApplication { } )
from MvvmCross.Forms package readme.txt file, when all other platforms, again, expect inheritance for the app classes from MvxForms*-based ones.
MvvmCross guys, any thoughts on that?
When I set up a new Xamarin.Forms project, I always follow the Playground sample in the MvvmCross GitHub as this example evolves along with the API and is always up-to-date, as it is part of the MvvmCross solution, so any commits need to preserve its functionality. So if you want to see how everything should look in a minimal UWP + Xamarin.Forms project see the Playground.Forms.UI and Playground.Forms.Uwp projects in the linked folder.
My iOS version of the app used to run until a few weeks ago. I started receiving this error on launch:
Anyone else ever get this error?
UPDATE:
I have RxUI 7.4.0 installed on all platform projects:
As well, my base viewmodel is as follows:
public abstract class ViewModelBase : ReactiveObject, IRoutableViewModel, ISupportsActivation
It's not clear what version you're using, but it sounds like you need the ReactiveUI.XamForms package installed.
Never got to the source of the problem, but I solved this by recreating a new iOS project (simple process for a XF app) and re-adding all the nuget packages.
First up, I'm fairly new to .NET and C# and this is a project to learn C# and CEF at the same time.
I have followed a number of tutorials from the net as well as looking into the CefSharp examples to create a WinForms application.
I have installed CefSharp.WinForms 53.0.1 from NuGet, and my project is using Any CPU (CefSharp 51+ has Any CPU support).
To achieve this I largely followed the tutorial from Ourcode (http://ourcodeworld.com/articles/read/173/how-to-use-cefsharp-chromium-embedded-framework-csharp-in-a-winforms-application). I made the changes for Any CPU as suggested and included the basic code to load google.
Everything builds fine, but when the form displays there's no browser shown, just a blank form.
If I set the target to x64 or x86, then the browser displays as expected.
I notice in the Ourcode comments that user Edek Halon has had the same issue, but no solution seems to be provided. Edek, has the same setup as me, so I wonder if this is an issue in 53.0.1? Potentialy Joey De Vries in the comments has the same issue.
The addition of support for Any CPU in CefSharp is covered in this GitHub issue : https://github.com/cefsharp/CefSharp/issues/1714
There is a troubleshooting page for CefSharp (https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting) and it seems a bit contradictory. Under General Troubleshooting
1) Platform Target You must select either x86 or x64 when using the NuGet packages. If you select AnyCPU the NuGet magic won't work currently.
Does CefSharp need to be built from source for Any CPU to work?
Just if anyone is having difficulties with this, follow the Github Tutorial at the following link : https://github.com/cefsharp/CefSharp/issues/1714
Basically the code should be as follows (Winforms Example):
CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
Cef.EnableHighDPISupport();
CefSettings settings = new CefSettings
{
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"), //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
BrowserSubprocessPath = #"x86\CefSharp.BrowserSubprocess.exe"
};
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); // Initialize cef with the provided settings
chromeBrowser = new ChromiumWebBrowser("http://ourcodeworld.com"); // Create a browser component
this.Controls.Add(chromeBrowser); // Add it to the form and fill it to the form window.
chromeBrowser.Dock = DockStyle.Fill;