Hello guys i wish you all having good day i am relly thankful for your support on my last Questions ,
but i have one more i built my app using dapper orm i connected to sql server direct from the app , i know it is not best practice but it is works for me , but dapper wont work on ios , is there any solution for that i am getting the error : "operation is not supported on this platform" and the causer point to the quary on dapper
Dpper orm
How to create Button with BorderRadius in XAML?
Hi everybody!
Please tell me how to create Button with BorderRadius in Xamarin.Forms using OnPlatform!
Thank you!
Xamarin forms android splash screen appear when navigation.pushasync and navigation.popasync
style.xml
<? xml version="1.0" encoding="utf-8"? >
< resources >
< style name = "MainTheme" parent="MainTheme.Base" >
< /style >
< item name = "windowNoTitle"> true < /item >
< item name="windowActionBar">false< /item>
< item name = "colorPrimary">#2196F3< /item>
< item name="colorPrimaryDark">#1976D2< /item>
< item name = "colorAccent">#FF4081< /item>
< item name="windowActionModeOverlay">true
< item name = "android:datePickerDialogTheme" > @style / AppCompatDialogStyle </ item >
</ style>
< style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog" >
< item name = "colorAccent" >#FF4081< /item>
< /style>
< style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar" >
< item name = "android:windowBackground"> @drawable / Splash_background < / item>
</ style>
</ resources>
and
mainActivity class
[Activity(Label = "xxx", Icon = "@mipmap/icon", Theme = "@style/MyTheme.Splash", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait, WindowSoftInputMode = SoftInput.AdjustResize)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
public FirebaseAnalytics firebaseAnalytics;
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
LoadApplication(new App());
}
}
help me to resolve the issue
Creating a Custom Control by Inheriting from Button
I am working on converting my apps from UWP to Xamarin. In my UWP apps, I had a custom control that inherited from Button. The control overrode and added several properties (including the Template property, which used my added properties using TemplateBinding). I have found information on how to inherit from ContentView in Xamarin, but I need the functionality & properties inherited from Button. How can I do something similar to create a custom Button in Xamarin? Thanks.
Font awesome icon in Xamarin forms.
How to use font awesome icon with button and other control in xamarin forms?
Thanks in Advance.
Issue with Plugin.BLE do not scan devices
Hi!
I'm facing a issue trying to connect to a Bluetooth LE device.
I downloaded the Plugin.BLE and I used the sample included without any problem, I connect and read/write data.
Now, I try to deploy on my App, I follow the instructions on the github repository, add permissions to AndroidManifest.xml. , but when I execute adapter.StartScanningForDevicesAsync(), nothing happens, I don't get the list of devices. There are several devices all around and also the one I want to connect to.
This is my code
public partial class PageSettingsDevice : ContentPage
{
IBluetoothLE ble;
IAdapter adapter;
ObservableCollection deviceList;
IDevice device;
private CancellationTokenSource _cancellationTokenSource;
public PageSettingsDevice()
{
InitializeComponent();
ble = CrossBluetoothLE.Current;
adapter = CrossBluetoothLE.Current.Adapter;
deviceList = new ObservableCollection<IDevice>();
//adapter.DeviceDiscovered += _bleAdapterDeviceDiscovered;
}
private bool status()
{
var state = ble.State;
DisplayAlert("Notice", state.ToString(), "OK !");
if (state == BluetoothState.Off)
{
DisplayAlert("Atención", "Your Bluetooth is off ! Turn it on !", "Aceptar");
}
if (ble.State == BluetoothState.Off || ble.State == BluetoothState.TurningOff || ble.State == BluetoothState.Unauthorized || ble.State == BluetoothState.Unknown)
return false;
else
return true;
}
async void OnDiscoverDeviceBlueToothClicked(object sender, EventArgs e)
{
try
{
if (status())
{
adapter.DeviceDiscovered += (s, a) =>
{
if (device.Name.Contains("Coltech"))
adapter.ConnectToDeviceAsync(device);
};
//We have to test if the device is scanning
if (!ble.Adapter.IsScanning)
{
_cancellationTokenSource = new CancellationTokenSource();
adapter.ScanMode = ScanMode.LowLatency;
await adapter.StartScanningForDevicesAsync(null,null,false,_cancellationTokenSource.Token);
var list = adapter.ConnectedDevices;
}
}
}
catch (Exception ex)
{
DisplayAlert("Notice", ex.Message.ToString(), "Error !");
}
}
async void _bleAdapterDeviceDiscovered(object sender, DeviceEventArgs e)
{
if (device != null)
{
if (device.Name.Contains("Coltech"))
await adapter.ConnectToDeviceAsync(device);
}
}
}
Any help is wellcomed, thanks
Get file path from content.
Hi everyone,
I have a Xamarin.Forms (iOS, Android) app and I open it as option to Open PDF documents. For Android app, I set an intent-filter with mimetype: pdf.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/pdf" />
</intent-filter>
Is there any way to do the same thing on iOS?
And I have another problem. After I open my app, I want to retrieve the file's path from intent, but I get something like that:
content://com.android.providers.downloads.documents/document/22
Is there any way to get the file path from that content?
Thank you.
Encode array\list of images to video MP4 in xamarin
I'm building an app that encodes a stream of images or an array of images into MP4 video in Xamarin forms. I couldn't find anything that works with xamarin forms and I've already tried these:
1. FFmpeg - (not working in xamarin native, require .netCore (I'm getting errors when installing any related NuGet package)
2. libvlc - I don't think it has any converting or encoding capabilities.
3. searched in google, here and xamarin forum for a solution.
4. skiasharp - apparently use only for drawing 2D and not for video encoding.
5. Nreco - needs licence.
6. AviSharp/Aforge/Mediacodec/etc - Just for iOS\Android
7. Encode MP4 from scrach - noticed that's too much work.
is there any way to do it without encoding the video on each platform-specific?
Thanks in advance!
I want to use "ConsumerIrService" in Xamarin.Forms
mCIR = (ConsumerIrManager)GetSystemService(Context.ConsumerIrService);
I have been using this in Xamarin.Android but recently I needed to use this in Xamarin.Forms but it is throwing this error "Error CS0103 The name 'GetSystemService' does not exist in the current context"
Just found out that if "GetSystemService" is called in MainActivity then it works but if it is called in any other class then it throws error as mentioned above.
Can someone please guide me what am I missing here?
Thanks in advance.
Multiple Image Picker in Xamarin.Forms
Hi everyone, I'm new to this forum and I'm kinda new also with xamarin (just 2 months).
I'm developing an app that allows users to choose a product and apply some customizations to it like adding an image, move that image within the frame and so on...
I'm stuck with the part of the multipicker from the gallery.
I've tried many solutions suggested by many developers but all of them didn't seem to work for me: they actually do open the gallery and let user pick an image but I need to select more than one at a time!
I've tried both implementing code in my project and then downloading the sample from github of those projects and install it on my phone (Android 8.0) and even on an emulator (Android 4.0).
None of this worked for me.
I need a solution that works both for android and for iOs and I'm afraid that doesn't actually exists.
If you want to know more about what I've already tried just ask, moreover is really xamarin worth it for app development? Would you reccomend it or is it better going for Java/Kotlin & C++/Swift/XCode?
Sorry if I mispelled something, english isn't my primary language.
Convert GoogleMap Snapshot Java solution to Xamarin C#
how to adopt the above google solution to Xamarin.Forms C#
Style not honoring value set by StaticResource in Resources?
Hello Everyone,
I have set certain values to a property (IconWidth) in the Resources of a content view. This property is being used in a Style also contained in the same place.
However, when this is used in the style, the Image view seems to ignore this.
For example -
This doesn't work
<OnPlatform x:TypeArguments="x:Int32" Android="32" iOS="32" Default="32" x:Key="IconWidthVertical"/>
<Style TargetType="Image" x:Key="statusIconStyles">
<Setter Property="WidthRequest" Value="{StaticResource Key=IconWidthVertical}" />
<Setter Property="Aspect" Value="AspectFit"/>
</Style>
However, this does -
<Style TargetType="Image" x:Key="statusIconStyles">
<Setter Property="WidthRequest" Value="32" />
<Setter Property="Aspect" Value="AspectFit"/>
</Style>
What am I doing wrong here? Why dosen't the StaticResource
binding work?
Remove Hamburger Menu icon (UWP)
Hi,
I'm using a master detail page to display a hamburger menu for my 3 apps (Android, iOS and UWP).
In the Android and iOS apps, every time I navigate into a detail page, I get a back button where the hamburger icon was previously placed, but in UWP this back button is displayed in the top of the hamburger icon (I can see both of them at the same time).
I just want to let the navigation using the hamburger menu from the home page.
So is there any way of disabling the hamburger menu or hiding the icon whenever I'm not in my homepage?
Thanks in advance
AdMob and mediation
Is it right that I need for each advertiser a seperate sdk? Is there a list with sdks for xamarin, because the most I found dont work with xamarin.
I've tried to work with facebook audience, but I have issues with the aar binding. I get a lot of binding errors when I try to build the aar-binding dll...
So please boys and girls, help me

Extended DatePicker? How to disable certains days from DatePicker?
Hello there, I'm trying to disable certain days, like weekends, from a datepicker, but it seems I can only set min and max selectable dates. Is there anyway to achieve that? or is there any compatible XForms Nuget Package that allows me to do it?
Android Emulator not consuming API and giving error System.Net.WebException: 'Failed to connect to
l have an api backend in a .net core web app and have written the code to consume the api in xamarin.forms. when l run the code
l get the following error.
System.Net.WebException: 'Failed to connect to /127.0.0.1:44360'.
Below is my code in xamarin.forms
public MainPage()
{
InitializeComponent();
Comic();
}
public async void Comic()
{
using(var httpClient = new HttpClient()){
var response = await httpClient.GetStringAsync("https://127.0.0.1:44360/api/comic");
var comic = JsonConvert.DeserializeObject<List<Comic>>(response);
comicList.ItemsSource = comic;
}
}
A bit of research says something about configuring the web app to use 127.0.0.1 instead of localhost and it been
specific to android.what can l do to fix this error.
How to add rectangle in xamarin forms?
Hi, I need to add a rectangle box and i want to place my text in the center .Please guide
Detecting KeyDown in an entry?
Hi,
I'd like to detect when the backspace keyboard button is pressed in an Entry even when there is no text in the entry. I've tried creating a custom renderer and overriding OnKeyDown but it doesn't seem to do anything. In my custom android renderer that extends Entry:
public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
{
Console.WriteLine("A key was pressed");
if (keyCode == Keycode.Del)
{
// do stuff here
}
return base.OnKeyDown(keyCode, e);
}
Unfortunately this doesn't seem to do anything. How can I achieve this?
ImageSource not works with Android mipmap folders
Recently i migrated an Android project, I'm using version 4.3.0.908675 of Xamarin.Forms.
I added all the images in Android mipmap folders that were previously drawable, but now my image does not load, when debugging everything seems to be right but when displaying the screen no images appear.
My code to add image source
stlLogo = new StackLayout
{
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = new Thickness(20, 0, 20, 40)
};
imgLogo = new Image
{
Source = ImageSource.FromFile("ig_splash_logo")
};
Xamarin forms Android, background bluetooth connection
Hello guys,
My app requires to connec to known Ble device at the start of the application, and keep the connection for a long periods of time even when the screen is locked.
Therefore I need to keep connection in the background task/service.
For now I ve been using https://github.com/xabre/xamarin-bluetooth-le for all the bluetooth interactions.
Seems like I need to implement Long running task in platform specific code.
Have anybody implemented this plugin to work as background services without bugs or do you have any resources that could help me?