I created a xamarin forms project which is using oxyplot and Rg.Plugins.Popup xamarin forms.
However, the graph does not work as excepted. I modified code refer to the link, but graph not show on UWP .
In addition, I init Rg.Plugins.Popup and oxyplot with follow code, I don't know what I doing wrong. Please help. thanks in advance.
in UWP project App.xaml.cs
Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());
List<Assembly> assembliesToInclude = new List<Assembly>();
//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof(OxyPlot.PlotModel).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.PlotController).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Windows.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer).GetTypeInfo().Assembly);
try
{
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
}
catch (Exception ex) { }
OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init();
Xamarin forms and oxyplot version is
OxyPlot.Xamarin.Forms : 1.1.0-unstable0011
Xamarin.Forms: 4.2.0.709249
If you want to use both of them, you could insert their assemblie in the same list. For more please refer the following.
List<Assembly> assembliesToInclude = new List<Assembly>();
Popup.Init();
OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init();
assembliesToInclude.Add(typeof(OxyPlot.PlotModel).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.PlotController).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Windows.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer).GetTypeInfo().Assembly);
var assemblies = Popup.GetExtraAssemblies();
assembliesToInclude.AddRange(assemblies);
var count = assembliesToInclude.Count;
try
{
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
}
catch (Exception ex) {
}
Related
I am kind of new to Xamarin development. I tried to change the back button behavior with a binding command, but that didn't seem to work. This is the code for the view:
<Shell.BackButtonBehavior>
<BackButtonBehavior Command="{Binding GoBack}"/>
</Shell.BackButtonBehavior>
And this is the code for the view model:
public CreatePasswordVM()
{
_goBack = new Command(GoBackButton);
}
private ICommand _goBack;
public ICommand GoBack
{
get { return _goBack; }
}
public async void GoBackButton()
{
await Shell.Current.GoToAsync("../..");
}
When I pressed the back button, the method "GoBackButton" didn't call. I want to mention that on Android works.
Shell BackButtonBehavior command binding not working in UWP
Derive from Xamarin Form source code. BackButtonBehavior has not implemented for UWP platform, we could find Android and IOS implementation here and here. But for uwp there is not such tracker and there is not such value in the UWP ShellRenderer. For this scenario, we suggest your post new feature request in the Xamarin Forms github.
i am using Messier16.Forms.Checkbox library for Checkbox Control in Xamarin Windows App. it does not have Selected event.
Kindly suggest any library in xamarin UWP project for Checkbox control which contains Selected Event.
Thanks in Advance
Reddy Krishna
From the sample source of Messier16.Forms.Controls.Checkbox:
checkbox.PropertyChanged += (sender, e) =>
{
if (e.PropertyName.Equals("Checked"))
{
cb2.IsEnabled = checkbox.Checked;
cb3.Checked = !checkbox.Checked;
}
};
Re: https://github.com/messier16/Forms.Controls/blob/master/Sample/SampleLocalApp/SampleLocalApp/Pages/CheckboxPages/CheckboxCodePage.cs#L31
I have created a forms page in Xamarin and used that page as a fragment using Xamarin Forms Embedding.
var fragment = new FormsPage().CreateFragment(context);
I would like to override the OnBackPressed() control in Android version of the app.
What's the best possible way to do it as I can't override it inside the Xamarin Forms Page.
I would like to override the OnBackPressed() control in Android version of the app.
You could override OnBackButtonPressed in Xamarin.Forms, this event also be raised when the hardware back button is pressed in Android and this event is not raised on iOS.
If you want remove fragment from the stack in OnBackPressed() method, you could override this method in your Activity like this :
public override void OnBackPressed()
{
base.OnBackPressed();
if (FragmentManager.BackStackEntryCount != 0)
{
FragmentManager.PopBackStack();
}
else
{
base.OnBackPressed();
}
}
I'm currently developing a barcode-scanning Xamarin.Forms Project for iOS, Android and Universal Windows using ZXing for Forms.
The scan works just fine in Android and iOS project, but in UWP it won't work:
First, scanning only works, when I do it in landscape-orientation. In portrait no barcode can be scanned.
Second, everytime I finish scanning (both by cancelling and by scanning Barcode correctly) the app crashes when I rotate the device.
The exception: "The stream number provided was invalid.\r\nPreviewState" System.Runtime.InteropServices.COMException
I'm launching the scan as simple as possible:
async void scan(object sender, EventArgs e)
{
var scanPage = new ZXingScannerPage();
scanPage.OnScanResult += (result) => {
scanPage.IsScanning = false;
Device.BeginInvokeOnMainThread(() => {
Navigation.PopAsync();
DisplayAlert("Scanned Barcode", result.Text, "OK");
});
};
await Navigation.PushAsync(scanPage);
}
Xamarin.Forms v2.3.0.49, ZXing.Net.Mobile.Forms v2.0.4.46.
Thanks for your help!
I am trying to add UIScreenEdgePanGesture in Xamarin for iOS. But it crashes. I am using following code
UIScreenEdgePanGestureRecognizer rightEdgeGesture = new UIScreenEdgePanGestureRecognizer (HandleRightEdgeGesture);
rightEdgeGesture.Edges = UIRectEdge.Right;
View.AddGestureRecognizer (rightEdgeGesture);
and also handle action
public void HandleRightEdgeGesture(UIScreenEdgeGestureRecognizer recognizer){
Console.WriteLine("Screen to right");
}
Please help me if I am writing any wrong syntax.