How does one become a Xamarin Author and Xamarin MVP?
How does one become a Xamarin Author and Xamarin MVP
AMD Ryzen 7 2700X
I’m considering upgrading from my Dell XPS 13 i7-3537U laptop to an AMD Ryzen 7 2700X Desktop. I find that with my Dell XPS emulators are slow even using Hyver-V (well really slow), I’m also looking for faster compile times.
For instance, running this: https://github.com/Microsoft/TailwindTraders-Mobile it takes forever to run on the emulator...
Is anybody developing Xamarin apps with this processor or similar?
What are Android emulators on Hyver-V like?
Would it be worth the upgrade?
Thanks!
Why is the Custom Picker SelectedItem always wrong?
Hello community,
how can I read the selected Item of my custom picker?
I'm facing the problem for hours but have no further idea on how to fix it.
I need the selected Value after clicking on the DoneBtn.
Thank you in advance!!
Class PickerRendererIos.cs :
[assembly: ExportRenderer(typeof(MyPickerRenderer), typeof(PickerRendererIos))]
namespace DigitalNatives.iOS
{
public class PickerRendererIos : PickerRenderer, IUIPickerViewDelegate
{
IElementController ElementController => Element as IElementController;
public String test = "";
public PickerRendererIos()
{
}
[Export("pickerView:viewForRow:forComponent:reusingView:")]
public UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
{
UILabel label = new UILabel
{
TextColor = UIColor.Blue,
Text = Element.Items[(int)row].ToString(),
TextAlignment = UITextAlignment.Center,
};
test = label.Text;
Console.WriteLine(Element.Items[(int)row]);
return label;
}
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
if (Control != null)
{
UIPickerView pickerView = (UIPickerView)Control.InputView;
pickerView.WeakDelegate = this;
pickerView.BackgroundColor = UIColor.White;
/* var picker = (Picker)this.Element;
picker.SelectedIndexChanged += (sender, ee) =>
{
//test = picker.Items[picker.SelectedIndex];
test = picker.SelectedItem.ToString();
}; */
}
if (e.OldElement != null)
{
var toolbar = (UIToolbar)Control.InputAccessoryView;
var doneBtn = toolbar.Items[1];
doneBtn.Clicked -= DoneBtn_Clicked;
}
if (e.NewElement != null)
{
var text = e.NewElement.SelectedItem;
// test = text.ToString();
var toolbar = (UIToolbar)Control.InputAccessoryView;
var doneBtn = toolbar.Items[1];
doneBtn.Clicked += DoneBtn_Clicked;
}
}
void DoneBtn_Clicked(object sender, EventArgs e)
{
Console.WriteLine("Clicked!!!!");
Element.SelectedItem = test;
}
}
}
how to display .gif image as launch screen(splash screen) in xamarin forms ios
how to display .gif image as launch screen(splash screen) in xamarin forms ios.i have idea in xamarin forms android but i don't have idea in ios.please share with me if any one have idea
forms App logs out in the background
Putting my Xamarin forms App to Background and bringing it back logs out my App. This happens only in some devices( Zebra Scanning device TC75 EK android v 7.1.2) . This problem is not seen in other devices. Can someone help me with this. Thanks in advance.
How to make pinch and Touched working using SkCanvasView
Hello,
i am added following code to get pinch and touch event working using SkCanvasView.
<views:SKCanvasView x:Name="canvas" PaintSurface="OnPaintSample" >
<views:SKCanvasView.GestureRecognizers>
<PinchGestureRecognizer PinchUpdated="PinchGestureRecognizer_PinchUpdated" />
</views:SKCanvasView.GestureRecognizers>
</views:SKCanvasView>
<Grid.Effects>
<local:TouchEffect Capture="True"
TouchAction="OnTouchEffectAction" />
</Grid.Effects>
i am geeting issue when i add both only pinch get working. but when i click on canvas touch event not trigger.
when i comment out pinch event then onlt touch event trigger.
can any one having solution how to make both event working simultaneously.
please give me solution.
Switch crashing UWP app post upgrade to XF 3.6
Just upgraded my app to Forms v3.6 when testing the Windows / UWP app any page with a switch crashes the app with the error:
Exception: {System.ArgumentException: The parameter is incorrect.
element
at Windows.UI.Xaml.VisualStateManager.GetVisualStateGroups(FrameworkElement obj)
at Xamarin.Forms.Platform.UWP.SwitchRenderer.UpdateOnColor()
at Xamarin.Forms.Platform.UWP.SwitchRenderer.OnControlLoaded(Object sender, RoutedEventArgs e)}
Handled: false
Message: "System.ArgumentException: The parameter is incorrect.\r\n\r\nelement\r\n at Windows.UI.Xaml.VisualStateManager.GetVisualStateGroups(FrameworkElement obj)\r\n at Xamarin.Forms.Platform.UWP.SwitchRenderer.UpdateOnColor()\r\n at Xamarin.Forms.Platform.UWP.SwitchRenderer.OnControlLoaded(Object sender, RoutedEventArgs e)"
Native View: To inspect the native object, enable native code debugging
I removed all binding from the Swtich so its just in the Xaml any ideas?
How to ACCESS DATABASE in XAMARIN.FORMS?
Good Day everyone. I'm having trouble on how am I going to show all the records I have created in my ASP.NET WEB API to Xamarin.Forms Application. I tried creating pre-defined list of Employee's Name and Department and it worked. But what I want to do is Create a Record in ASP.NET Web Application and make it appear to my mobile application. Any help will be highly appreciated. Here's my code. I'm just a newbie so please forgive me if my question isn't seem to be informative. Thanks in advance. I watch a video tutorial regarding this matter._ Refer to this link if needed. _
MainViemMain.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="XamarinFormsDemo.MainPageMain"
xmlns:ViewModels="clr-namespace:XamarinFormsDemo.ViewModels;assembly=XamarinFormsDemo">
<ContentPage.BindingContext>
<ViewModels:MainViewModel/>
</ContentPage.BindingContext>
<StackLayout>
<ListView ItemsSource="{Binding EmployeesList}"
HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical"
Padding="12,6">
<Label Text="{Binding Name}"
FontSize="24"/>
<Label Text="{Binding Department}"
FontSize="18"
Opacity="0.6"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Text="Read This!"/>
</StackLayout>
</ContentPage>`
MainViewModel.cs
`using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using XamarinFormsDemo.Models;
using XamarinFormsDemo.Services;
namespace XamarinFormsDemo.ViewModels
{
public class MainViewModel : INotifyPropertyChanged
{
private List<Employee> _employeesList;
public List<Employee> EmployeesList
{
get { return _employeesList; }
set
{
_employeesList = value;
OnPropertyChanged();
}
}
public MainViewModel()
{
InitializeDataAsync();
}
private async Task InitializeDataAsync()
{
var employeesServices = new EmployeesServices();
EmployeesList = await employeesServices.GetEmployeesAsync();
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}`
EmployeesServices.cs
`
using Plugin.RestClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XamarinFormsDemo.Models;
namespace XamarinFormsDemo.Services
{
public class EmployeesServices
{
public async Task<List<Employee>> GetEmployeesAsync()
{
RestClient<Employee> restClient = new RestClient<Employee>();
var employeesList = await restClient.GetAsync();
return employeesList;
}
}
}
`
Error using Microcharts:
Hi every one,
I´m using the microcharts library in order to show a chart, but currently I´m getting the following error and I not able to show the chart. Iam using Xamarin Live application on my Android phone. The library that I am using is "microcharts-elegant-cross-platform-charts-for-any-app"
And the error is: Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'. I getting the error in the line "var entries= new[]...."
public Chart LastRidesChart
{
get
{
var entries = new[] {
new Entry(212)
{
Label = "UWP",
ValueLabel = "212",
Color = SKColor.Parse("#2c3e50")
},
new Entry(248)
{
Label = "Android",
ValueLabel = "248",
Color = SKColor.Parse("#77d065")
},
new Entry(128)
{
Label = "iOS",
ValueLabel = "128",
Color = SKColor.Parse("#b455b6")
},
new Entry(514)
{
Label = "Shared",
ValueLabel = "514",
Color = SKColor.Parse("#3498db")
} };
return new PointChart()
{
Entries = entries,
};
}
}
Pairing Visual Studio 2019 to an OSX VM
I'm having problems connecting my Win10 Visual Studio machine to my VMWare OSX machine via visual studio for development.
The Pair to Mac dialog keeps reporting:
"An unexpected error occurred while checking the SSH configuration of 'Mac'
No connection could be made because the target machine actively refused it"
I can ping the VM, have enabled remote login, turned of the OSX firewall and connected successfully with Git Bash via ssh from my PC - but it doesn't want to do it through visual studio
Anything I'm doing wrong? Is it too early for 2019? Any Advice?
Tabbed Page Icon
Hi, I want to show tabbed pages icon in top of title but it show before title. Please help me to show icon in top of title in xamarin form.
How to get Local time for a specific zone using .NET Standard?
Hi,
I am using this in C# but I want to get the same in Xamarin in order to get the current time for Dubai.
How to achieve that?
I tried the same code but getting:
System.TimeZoneNotFoundException: Arabian Standard Time
at System.TimeZoneInfo.GetMonoTouchData (System.String name, System.Boolean throw_on_error) [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:98
at System.TimeZoneInfo.FindSystemTimeZoneByIdCore (System.String id) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:56
at System.TimeZoneInfo.FindSystemTimeZoneById (System.String id) [0x00021] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.cs:574
at Jafaria.HomePage.GetDubaiLocalTime () [0x00001] in /Users/jassim/Projects/Jafaria/Jafaria/HomePage.xaml.cs:274
at Jafaria.HomePage+d__15.MoveNext () [0x0001e] in /Users/jassim/Projects/Jafaria/Jafaria/HomePage.xaml.cs:306
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at UIKit.UIKitSynchronizationContext+<>c__DisplayClass1_0.b__0 () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIKitSynchronizationContext.cs:24
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/Foundation/NSAction.cs:125
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at Jafaria.iOS.Application.Main (System.String[] args) [0x00001] in /Users/jassim/Projects/Jafaria/iOS/Main.cs:18
here is the code:
TimeZoneInfo DubaiTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Arabian Standard Time");
DateTime utc = DateTime.UtcNow;
DateTime DubaiLocalTime = TimeZoneInfo.ConvertTimeFromUtc(utc, DubaiTimeZone);
// DateTimeOffset DubaiLocalTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Arabian Standard Time"));
LabelHomeMageLocalTime.Text = DubaiLocalTime.ToString("HH:mm");
Thanks,
Jassim
How can I implement push notification in Xamarin forms
I am going to implement push notification for my Xamarin Forms project targeting IOS, Android and UWP.
Is there any Nuget Package available for this feature? Or this feature requires platform-specific implementation? And is push notification works on UWP?
What is Azure Notification Hubs? Is that necessary to implement push notification in xamarin forums?
I found a blog about this feature here, but in that the notifications are sending from Azure portal. My project was a chat application and the push notification should come when a new message sends.
Any help would be greatly appreciated. Sample codes or tutorial references are welcome.
UITextfield numbers and decimals only
My simple app is just a form that sends an email. I need to restrict the text box to numbers only and only 6 characters long. However, the group using the app, wants one of the fields to allow decimal.
Right now Im using this code to restrict size and number. Is there a better way to do this?
txtTakeoffCG.ShouldChangeCharacters = (textField, range, replacement) =>
{
var newContent = new NSString(textField.Text).Replace(range, new NSString(replacement)).ToString();
int number;
return newContent.Length <= 6 && (replacement.Length == 0 || int.TryParse(replacement, out number));
};
Forms9Patch: Simplify multi-device image management in your PCL Xamarin.Forms mobile apps
Announcement of Form9Patch
Xamarin Forms is great for developing apps on Android and iOS but it is missing two important tools for developers: scalable images and PCL multi-screen image management. Android developers use NinePatch bitmaps and the drawable directory naming convention for this purpose. Likewise, iOS developers use ResizeableImageWithCapInsets and the @2x, @3x, @4x file naming convention for this purpose.
Forms 9 Patch enhances Xamarin Forms to enable multi-resolution / multi-screen image management to PCL apps for iOS and Android.
What is it?
Simply stated, Forms9Patch is two separate elements (Image and ImageSource) which are multi-screen / multi-resolution extensions of their Xamarin Forms counterparts.
Forms9Patch.ImageSource
Xamarin Forms provides native iOS and Android multi-screen image management (described here). This requires storing your iOS images using the native iOS schema and storing your Android images using the Android schema. In other words, duplicative efforts to get the same results on both Android and iOS. Forms9Patch.ImageSource extends Xamarin.Forms.ImageSource capabilities to bring multi-screen image management to your PCL assemblies - so you only have to generate and configure your app's image resources once. Forms9Patch.ImageSource is a cross-platform implementation to sourcing multi-screen images in Xamarin Forms PCL apps as embedded resources.
Forms9Patch.Image
Forms9Patch.Image compliments Xamarin.Forms.Image to provide Xamarin Forms with a scaleable image element. Scalable images are images that fill their parent view by stretching in designated regions. The source image for the Forms9Patch.Image element can be specified either as a Forms9Patch.ImageSource or a Xamarin.Forms.ImageSource. Supported file formats are NinePatch (.9.png), .png, .jpg, .jpeg, .gif, .bmp, and .bmpf.
Example code
After adding the file bubble.9.png to your PCL project assembly as an EmbeddedResource, you can display it using something like the following:
var bubbleImage = new Forms9Patch.Image () {
Source = ImageSource.FromResource("MyDemoApp.Resources.bubble.9.png"),
HeightRequest = 110,
}
var label = new label () {
Text = "Forms9Path NinePatch Image",
HorizontalOptions = LayoutOptions.Center,
}
Example XAML
In Xamarin Forms, access to embedded resources from XAML requires some additional work. Unfortunately, Forms9Patch is no different. As with Xamarin Forms, you will need (in the same assembly as your embedded resource images) a simple custom XAML markup extension to load images using their ResourceID.
[ContentProperty ("Source")]
public class ImageMultiResourceExtension : IMarkupExtension
{
public string Source { get; set; }
public object ProvideValue (IServiceProvider serviceProvider)
{
if (Source == null)
return null;
// Do your translation lookup here, using whatever method you require
var imageSource = Forms9Patch.ImageSource.FromMultiResource(Source);
return imageSource;
}
}
Once you have the above, you can load your embedded resource images as shown in the below example. Be sure to add a namespace for the assembly that contains both your MarkupExtension and your EmbeddedResources (local in the below example).
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyXamlDemo;assembly=MyXamlDemo"
x:Class="MyXamlDemo.MyPage"
Padding="5, 20, 5, 5">
<ScrollView>
<ScrollView.Content>
<StackLayout>
<Label Text="Xamarin.Image"/>
<Image Source="{local:ImageMultiResource Forms9PatchDemo.Resources.image}"/>
</StackLayout>
</ScrollView.Content>
</ScrollView>
</ContentPage>
Where to learn more
Project page: http://Forms9Patch.com
Nuget page: https://www.nuget.org/packages/Forms9Patch/0.9.1
Demo app repository: https://github.com/baskren/Forms9PatchDemo
How can i use nuget package manager
using xamarin .net standard project i face problem to install Xamarin.Android.Support.v7.AppCompat .
Package Xamarin.Android.Support.v7.AppCompat 28.0.0.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package .there is no option to change to upgrade .NETStandard,Version=v2.0 .
how can i use those pluging ?
HttpClient.SendAsync throws exception "no route to host"
The customers of our xamarin program have a local web service running.
The access is currently via HttpClient/SendAsync.
The web service is reachable via local WLAN and via port forwarding/DynDNS etc.
This is working for all but one customer.
Using local IP and WLAN it's working. But not from outside: "no route to host"
I'm investigating this issue with 3 devices: iOS, Android and UWP.
UWP is working
iOS: no route to host
Android: Network is unreachable
On all three devices Returns Dns.GetHostAddress the correct current IPv4/IPv6 address.
I did try Device.OpenUri("http://DynDnsAddress/Service.html").
All three devices are showing the correct result.
So why is OpenUri working and not HttpClient?
I did investigate a bit further with WebClient.GetStringAsync
UWP: is working
iOS: is working
Android: Network is unreachable
I did investigate a bit further with HttpWebRequest
UWP: is working
iOS: is working
Android: is working
So I will try to replace HttpClient with HttpWebRequest.
But still I'm wondering what's causing this behavoir.
Regards, Holger Gothan.
Before Build Command, access ${CONFIGURATION} and other variables
Hello,
I'm trying to make 2 scripts one for android and one for ios to include the git revision in the app build version.
But this is not the point of the question, the thing is, I'm doing some stuff in a custom command using a bash script which runs before build.
I need to access some environmental variables (${PROJECT_DIR}, ${INFOPLIST_FILE}, ${CONFIGURATION} and some other stuff) which as far as I understand, they seem to be used/managed in xcode..
(need them to set CFBundleVersion with PlistBuddy)
Are there any equivalent variables that I could use in a before build script?
retrieve image from local device via URL, to be submitted through POST request
Hello,
I was hoping somebody may be able to point me in the right direction.
I am using the plugin "MeduaPlugin" by JamesMontemagno to take and store images.
I have stored the path to the image within a SQLLite DB on the device.
I can use the stored path and use it as an ImageSource to show the image on screen and this works fine.
What i want to be able to do is retrieve the image itself, to be used as part of a POST request to an API.
I have tried the following:
byte[] data = File.ReadAllBytes(URL); but the URL is a string, rather than the image itself.
Thanks in advance to anyone who responds.
Kind regards,
Jay
CarouselView.FormsPlugin using in xaml, API can't not recevied
Hi guys
I want to use MVVM in my App, I have one page name [PageProgress] so it's ViewModel is [PageProgressViewModel].
I put CarouselView.FormsPlugin syntax in xaml,
namespace
xmlns:cv="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
cv:CarouselViewControl ItemsSource="{Binding dynamicwebimgurls}" Grid.Row="1" ShowArrows="true" ShowIndicators="true" Position="0">
if I write those code in xaml, viewmodel api can't get response. when I common out those codes, api will get a response.
ViewModel
namespace Vision.App.BusinessLogic
{
public class PageProgressViewModel : INotifyPropertyChanged
{
ObservableCollection<WebBackendImgpath> _dynamicwebimgurls;
ClinicWebInfRootObject WebData = new ClinicWebInfRootObject();
List<string> ImgUrls = new List<string>();
public ObservableCollection<WebBackendImgpath> Dynamicwebimgurls
{
set
{
_dynamicwebimgurls = value;
OnPropertyChanged("Dynamicwebimgurls");
}
get
{
return _dynamicwebimgurls;
}
}
ClinicWebInfRootObject clinicWebInf;
public event PropertyChangedEventHandler PropertyChanged;
public PageProgressViewModel()
{
PageProgress_FirstAction();
Dynamicwebimgurls = new ObservableCollection<WebBackendImgpath>();
foreach (var imgUrls in ImgUrls)
{
Dynamicwebimgurls.Add(new WebBackendImgpath(imgUrls));
}
}
public async void PageProgress_FirstAction()
{
WebData = await GetImagePath();
ImgUrls = WebData.Data.MainImgs;//this is image url I want to use it to be binding
}
public async Task<ClinicWebInfRootObject> GetImagePath()
{
clinicWebInf = new ClinicWebInfRootObject() ;
try
{
string aa = AppInfo.WebAPIUrlReg + WebApiRegEnum.Clinic + "/" + WebApiRegEnum.GetWebsiteInfo + "?"
+ WebApiRegEnum.ClinicCode + "=" + AppInfo.WebAPIUrlClinicCode;
clinicWebInf = await _WebAPIService.GetItemByGet<ClinicWebInfRootObject>(aa, true);
}
catch (Exception)
{
throw;
}
return clinicWebInf;
}
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Error message is [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
Please give advice thanks a lot!!