xamarin.forms

Camera capture image rotate to portrait - Xamarin android

天大地大妈咪最大 提交于 2021-02-11 16:44:44
问题 I have a xamarin.android project which have a custom camera Preview. Whenever I initialize the camera , it will open as landscape default. So I changed the orientation from SurfaceChanged method like this. private int setCameraDisplayOrientation(Activity mContext, int v) { var degrees = 0; var orientation =0; Display display = mContext.GetSystemService(Context.WindowService).JavaCast<IWindowManager>().DefaultDisplay; Camera.CameraInfo info = new Camera.CameraInfo(); Camera.GetCameraInfo(v,

Xamarin Media Plugin Auto start or Timer

此生再无相见时 提交于 2021-02-11 15:30:03
问题 In my iOS Xamarin forms project I'm using Xam.Plugin.Media from https://github.com/jamesmontemagno/MediaPlugin as follows async void Handle_Clicked(object sender, System.EventArgs e) { await CrossMedia.Current.Initialize(); var file = await CrossMedia.Current.TakeVideoAsync(new Plugin.Media.Abstractions.StoreVideoOptions { DefaultCamera = CameraDevice.Front, SaveToAlbum = true, }); } Is it possible to automatically start video recording or set a timer for the recording to start? Ultimately, I

How to connect to another device through Bluetooth and send some data and receive acknowledgement back- Xamarin

隐身守侯 提交于 2021-02-11 15:14:19
问题 I'm developing a Xamarin application using Visual Studio 2019. I have to connect to another device through Bluetooth and send some data and receive acknowledgment back. Tried this samples out But didn't help me while connecting for nearby Bluetooth devices, since the below codes are not giving expected results. bluetoothTxSocket = bluetoothDevice.CreateRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805f9b34fb")); bluetoothTxSocket.Connect(); Getting below exception

Save image from an image box to gallery in Xamarin Forms

…衆ロ難τιáo~ 提交于 2021-02-11 14:57:40
问题 Is there a way to save the picture in an image control to the Android gallery in Xamarin Forms? All help is appreciated. var image = new Image(); image.Source = "test.png"; Screenshot 回答1: You could use Dependency Service to get the stream from Resource/drawable image. Create the IDependency interface. public interface IDependency { MemoryStream DrawableByNameToByteArray(string fileName); } Android implementation public class DependencyImplementation : IDependency { public MemoryStream

How to use vertical Scroll view to show binding data

ⅰ亾dé卋堺 提交于 2021-02-11 14:45:16
问题 I want a structure like this : Click this to see the desired output But with my code i'm getting this : Click this to see the output Here is my xaml code : <ScrollView Orientation="Horizontal"> <StackLayout Orientation="Horizontal" VerticalOptions="Start"> <Grid x:Name="ImagesListViews" > <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> </Grid> <local:BindableStackLayout x:Name=

Xamarin Forms: How to implement location share feature?

和自甴很熟 提交于 2021-02-11 14:44:23
问题 Whenever I am opening my app I need to check the location is on or off. If the location is off, I need to show an alert to the user to enable location share like the below screenshot: I try this using the dependency service from this thread: The interface on shared Project: public interface ILocSettings { void OpenSettings(); } Android implementation [assembly: Dependency(typeof(LocationShare))] namespace ProjectName.Droid { public class LocationShare : ILocSettings { public void OpenSettings

Xamarin Forms - center title in a stacklayout

*爱你&永不变心* 提交于 2021-02-11 14:41:14
问题 The screenshot below shows a header that includes a hamburger menu and a title. Notice how the title is centered on it's bounding area (the red box). How can I get the title to center on the width of the phone, but leave the hamburger menu where it is? Here is the code that creates the header area... <?xml version="1.0" encoding="UTF-8"?> <ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="WP.MobileMidstream.Device.Pages

Xamarin Forms - center title in a stacklayout

大憨熊 提交于 2021-02-11 14:36:26
问题 The screenshot below shows a header that includes a hamburger menu and a title. Notice how the title is centered on it's bounding area (the red box). How can I get the title to center on the width of the phone, but leave the hamburger menu where it is? Here is the code that creates the header area... <?xml version="1.0" encoding="UTF-8"?> <ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="WP.MobileMidstream.Device.Pages

Xamarin Forms custom control: implement a method in the renderer

一笑奈何 提交于 2021-02-11 14:31:08
问题 I'm trying to create an extended version of the standard XF Map object: public class RRMap: Map { public void DoSomethingOnMap() { /* ... */ } } I also created an Android renderer (iOS will come later): [assembly: ExportRenderer(typeof(RRMap), typeof(RRMapRendererAndroid))] namespace MyApp.Droid.Renderers { public class RRMapRendererAndroid : MapRenderer { public RRMapRendererAndroid(Context context) : base(context) { } protected override void OnElementChanged(Xamarin.Forms.Platform.Android

Xamarin Forms: How to Change the textcolor of Collectionview SelectedItem?

对着背影说爱祢 提交于 2021-02-11 13:59:50
问题 I have a CarouselPage having 5 children and every child has a horizontal collection view. When selecting an item in Collectionview or swiping the pages, I need to give a different text color and need to add an underline for the selected item. I have tried like below: CarouselHomePage.cs public partial class CarouselHomePage : CarouselPage { public List<Activity> activityList { get; set; } public CarouselHomePage() { InitializeComponent(); activityList = new List<Activity>(); AddActivities();