Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 79144 articles
Browse latest View live

Unable to resolve host No address associated with host name

$
0
0

i host asp.net core web api in iis and i consumed in xamarin forms and i got this error
java.net.unknownhostexception unable to resolve host no address associated with hostname
i already added the all permission in AndroidManifest.xml,
and api work fine in postman


OpenTok Xamarin.Forms nuget Video Chat

Item Selected Event In BindableLayout

Export a scroll page to PDF

$
0
0

I need to convert my scroll page into the pdf in Xamarin forms. My Scroll page has contained so many elements and i need to export everything to the Pdf.

can anyone please help ?

Upload files to google drive using Xamarin forms iOS

$
0
0

The C# library GoogleDrive.API has been deprecated. How can I upload an image to my google drive? Or maybe to one drive?

Not able to register FCM/APNS token of firebase cloud messaging on Xamarin forms for iOS

$
0
0

I need to register FCM token to APNS which I have tried using below configurations and methods. I have configured firebase properly sent test messages to all the users and it works fine. but when I try to get installation id, either it doesn't give me the id or received id doesn't work. I have tried to use APNS token, FCM token and Device token (object of NSData) in RegisteredForRemoteNotifications method which is received in the parameter and also added DidReceiveRegistrationToken method. I also tried mapping APNS token with above 2 tokens but didn't work. I also tried to enable and disable Swizzling.

Messaging.SharedInstance.ApnsToken = DeviceToken;
Messaging.SharedInstance.ApnsToken = Messaging.SharedInstance.FcmToken;

I am attaching AppDelegate file for the reference

Change radiobutton checked color inside listview

$
0
0

Is there any way which i can change radiobutton's checked color inside listview for android and ios?
I tried this but it doesnt work.

<ContentPage.Resources>
        <Style TargetType="RadioButton">
            <Setter Property="VisualStateManager.VisualStateGroups">
                <VisualStateGroupList>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <VisualState.Setters>
                                <Setter Property="TextColor"
                                        Value="Red" />
                                <Setter Property="Opacity"
                                        Value="0.5" />
                            </VisualState.Setters>
                        </VisualState>
                        <VisualState x:Name="IsChecked">
                            <VisualState.Setters>
                                <Setter Property="TextColor"
                                        Value="Green" />
                                <Setter Property="Opacity"
                                        Value="1" />
                            </VisualState.Setters>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateGroupList>
            </Setter>
        </Style>
    </ContentPage.Resources>

On-Boarding screen not working in xamarin.forms

$
0
0

Hi, guys, I want to create an onboarding screen in Xamarin forms for both IOS & Android, I have looked at the posts online in order to try and help me but I am running into an error "CS0006" 'Metafile DLL could not be found'

I have tried Youtube and all forums examples but I am getting nowhere, can anyone help, please?

Thank You


Using message pack in xamarin forms

$
0
0

I'm trying to use Message Pack in Xamarin forms used the AOT tool too. But still, the Operation not supported in platform exception is thrown in Xamarin.Forms (iOS).

Steps followed:

Installed mpc tool.
Used don't mpc -i "{FormsProject.csproj path}" -o "{FormsProject directory path}"
Added the created message pack generated class to the forms project.
Used the following code in App.xaml.cs Initialize method

StaticCompositeResolver.Instance.Register(
     MessagePack.Resolvers.GeneratedResolver.Instance,
     MessagePack.Resolvers.StandardResolver.Instance);

Also using System.Drawing.Drawing2D.Matrix throws the following error

[MonoDroid]   at MessagePa07-10 18:06:01.269 I/MonoDroid(13495): MessagePack.MessagePackSerializationException: Failed to deserialize Project.Core.Models.SomeData Class value. ---> System.TypeInitializationException: The type initializer for 'FormatterCache`1' threw an exception. ---> MessagePack.Internal.MessagePackDynamicObjectResolverException: can't find public constructor. type:System.Drawing.Drawing2D.Matrix
[MonoDroid]   at MessagePack.Internal.ObjectSerializationInfo.CreateOrNull (System.Type type, System.Boolean forceStringKey, System.Boolean contractless, System.Boolean allowPrivate) [0x009a0] in <23c4c9b023514c20801c8f07fd69206c>:0 
[MonoDroid]   at MessagePack.Internal.DynamicObjectTypeBuilder.BuildType (MessagePack.Internal.DynamicAssembly assembly, System.Type type, System.Boolean forceStringKey, System.Boolean contractless) [0x00015] in <23c4c9b023514c20801c8f07fd69206c>:0 

Created a SO query and Github issue for the same.

Any help could be great.

frame gradient

$
0
0

Hello community

I am trying to achieve this

This is my code

    <ContentPage.Content>
        <ScrollView>
            <StackLayout>
                <magicgradients:GradientView VerticalOptions="CenterAndExpand"
                                             HeightRequest="400" Margin="10">
                    <magicgradients:GradientView.GradientSource>
                        <magicgradients:CssGradientSource>
                            <x:String>
                                <![CDATA[
                                 linear-gradient(180deg, rgba(182,130,252,1) 0%, rgba(75,17,103,1) 100%)
                                 ]]>
                            </x:String>
                        </magicgradients:CssGradientSource>
                    </magicgradients:GradientView.GradientSource>
                </magicgradients:GradientView>
            </StackLayout>
        </ScrollView>
    </ContentPage.Content>

I manege to achieve the gradient I want (Magic Gradients), but if I surround the gradient in a frame, I get a white thing, and I cannot put a frame inside.

You can see in the picture that I have a corner radius in the LoginBox in the middle, so it has to be a frame

I tried also creatind a custom render (https://stackoverflow.com/questions/28848545/add-gradient-background-to-layouts-in-xamarin-forms-visual-studio)

I also tried a nugget called Gloss or something

App Crash with SEGV Error

$
0
0

Hello -

I understand that I am likely not providing enough information to definitively resolve this issue. I am looking for guidance as to how to go about isolating, identifying and resolving this issue.

I am working with the following:

VS 2019 (16.6.3)
Xamarin.Forms (4.7.0.1080)
DevExpress Charts (20.1.4)

And testing on a physical device (because I have found that AVD testing is unreliable) -- Google Pixel 2 XL (Android 10, API 29).

The expected behavior when Tapping on a Bar in a BarChart is to show Hint Text -- usually the value associated with the Bar. Frequently my application crashes with the error message shown below.

A standalone test application works flawlessly -- so the third party Vendor assumes their library is not the source of the problem (although I am not convinced of this yet). My application seems to crash on random taps, although there is one chart that reliably crashes every time I Tap a particular bar in the chart. I have done much work trying to isolate the source of the crash -- including commenting out various chart settings, and building up a code scaffold around the test app similar to my application in an effort to reproduce. But have been unable to isolate the source.

I would appreciate any feedback on how to isolate, identify, and ultimately resolve this issue.

Thanks in advance.

  • Dean

=================================================================

Native Crash Reporting

Got a SEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

No native Android stacktrace (see debuggerd output).

=================================================================

Basic Fault Address Reporting

Memory around native instruction pointer (0x7527dce350):0x7527dce340 69 86 40 f9 fd 7b 41 a9 08 d1 34 8b 08 09 80 b9 i.@..{A...4.....
0x7527dce350 20 79 68 fc f4 4f c2 a8 c0 03 5f d6 f6 57 bd a9 yh..O...._..W..
0x7527dce360 f4 4f 01 a9 fd 7b 02 a9 fd 83 00 91 08 c0 45 39 .O...{........E9
0x7527dce370 f3 03 00 aa 68 05 00 35
88 0c 00 b0 00 3d c0 3d ....h..5.....=.=

=================================================================

Managed Stacktrace:

  at <unknown> <0xffffffff>
  at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007>
  at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
  at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377>
  at Android.Views.View:DispatchTouchEvent <0x001e7>
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1:DispatchTouchEvent <0x000cf>
  at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3>
  at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3>
  at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7>
  at <unknown> <0xffffffff>
  at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007>
  at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
  at JniInstanceMethods:InvokeVirtualBooleanMeth

od <0x00377>
at Android.Views.View:DispatchTouchEvent <0x001e7>
at Xamarin.Forms.Platform.Android.VisualElementRenderer1:DispatchTouchEvent <0x000cf> at DefaultRenderer:DispatchTouchEvent <0x0007f> at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3> at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3> at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7> at <unknown> <0xffffffff> at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007> at InstanceMethods:CallNonvirtualBooleanMethod <0x00333> at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377> at Android.Views.View:DispatchTouchEvent <0x001e7> at Xamarin.Forms.Platform.Android.VisualElementRenderer1:DispatchTouchEvent <0x000cf>
at DefaultRenderer:DispatchTouchEvent <0x0007f>
at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3>
at Android.Runtime.Dynami
cMethodNameCounter:26 <0x000e7>
at <0xffffffff>
at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007>
at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377>
at Android.Views.View:DispatchTouchEvent <0x001e7>
at Xamarin.Forms.Platform.Android.VisualElementRenderer1:DispatchTouchEvent <0x000cf> at DefaultRenderer:DispatchTouchEvent <0x0007f> at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3> at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3> at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7> at <unknown> <0xffffffff> at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007> at InstanceMethods:CallNonvirtualBooleanMethod <0x00333> at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377> at Android.Views.View:DispatchTouchEvent <0x001e7> at Xamarin.Forms.Platform.Android.VisualEle 07-09 16:03:20.562 F/libc (14970): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7635bf80a8 in tid 14970 (.contraxxmobile), pid 14970 (.contraxxmobile)mentRenderer1:DispatchTouchEvent <0x000cf>
at DefaultRenderer:DispatchTouchEvent <0x0007f>
at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7>
at <0xffffffff>
at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007>
at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377>
at Android.Views.View:DispatchTouchEvent <0x001e7>
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1:DispatchTouchEvent <0x000cf>
at DefaultRenderer:DispatchTouchEvent <0x0007f>
at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7>
at <0xffffffff>
at Java.Interop.NativeMethods:java_interop_jnienv

call_nonvirtual_boolean_method_a <0x00007>
at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377>
at Android.Views.View:DispatchTouchEvent <0x001e7>
at Xamarin.Forms.Platform.Android.VisualElementRenderer`1:DispatchTouchEvent <0x000cf>
at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent
<0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000d3>
at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7>
at <0xffffffff>
at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_boolean_method_a <0x00007>
at InstanceMethods:CallNonvirtualBooleanMethod <0x00333>
at JniInstanceMethods:InvokeVirtualBooleanMethod <0x00377>
at Android.Views.View:DispatchTouchEvent <0x001e7>
at Xamarin.Forms.Platform.Android.PlatformRenderer:DispatchTouchEvent <0x002eb>
at Android.Views.View:n_DispatchTouchEvent_Landroid_view_MotionEvent_ <0x000d3>
at Android.Runtime.DynamicMethodNameCount
er:26 <0x000d3>

at Android.Runtime.DynamicMethodNameCounter:26 <0x000e7>

Dotfuscator Root Check causes EncoderFallbackException in Xamarin Forms app

$
0
0

I use PreEmptive Dotfuscator to obfuscate my Xamarin Forms app for Android platform. I was able to build app earlier, but same DotfuscatorConfig.xml started giving exception when I upgraded Windows to 10, VS to 2019 and used latest version of Dotfucator Community version.

I am able to build successfully if I remove Root Check from DotfuscatorConfig.xml file.

Below is the VS output with Exception details:

2>  Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛嬝丟吡䴣吥䜧䐩䄫䬭帯䘱` which can't be resolved. (TaskId:285)
2>  Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Type[])' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2>  Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛圝漟డ琣䜥尧䈩` which can't be resolved. (TaskId:285)
2>  Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Type[])' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2>  Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛圝漟డ戣伥䐧伩` which can't be resolved. (TaskId:285)
2>  Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Reflection.BindingFlags)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2>MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "C:\Users\WinUser\AppData\Local\Temp\" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
2>MSBUILD : error MSB4166: C:\Users\WinUser\AppData\Local\Temp\MSBuild_pid-1412_8a13e9d544e74c94b378a56e64d81b58.failure.txt:
2>MSBUILD : error MSB4166: UNHANDLED EXCEPTIONS FROM PROCESS 1412:
2>MSBUILD : error MSB4166: =====================
2>MSBUILD : error MSB4166: 7/9/2020 11:46:12 AM
2>MSBUILD : error MSB4166: System.Text.EncoderFallbackException: Unable to translate Unicode character \uDDA3 at index 235 to specified code page.
2>MSBUILD : error MSB4166:    at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
2>MSBUILD : error MSB4166:    at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
2>MSBUILD : error MSB4166:    at System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder)
2>MSBUILD : error MSB4166:    at System.Text.UTF8Encoding.GetByteCount(String chars)
2>MSBUILD : error MSB4166:    at System.IO.BinaryWriter.Write(String value)
2>MSBUILD : error MSB4166:    at Microsoft.Build.Framework.BuildEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166:    at Microsoft.Build.Framework.LazyFormattedBuildEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166:    at Microsoft.Build.Framework.BuildMessageEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166:    at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
2>MSBUILD : error MSB4166:    at Microsoft.Build.Shared.LogMessagePacketBase.Translate(ITranslator translator)
2>MSBUILD : error MSB4166:    at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)

You must notice the Chinese characters in the initial logs - I wonder if it is the cause of issue.

Problem with conditional compilation

$
0
0

Good day!
if I run this fragment

var sCheck = "universal code";
# if _ ANDROID _
sCheck = "Android code";
# endif

on android device (or emulator) sCheck always has "universal code" value (I wait for "Android code" value). What I am doing wrong ?

I use Visual Studio Community 2017.

Thanks in advance for your help

Frame doesn't have shadow effect below API Level 28 Android

$
0
0

I've created a custom renderer for Frame to feel like CardView in Android it works fine on Android P but i've tested on API 21,22,23 it doesn't have any kind of effect. Here is my Android Renderer.

    public class ShadowFrameRenderer : Xamarin.Forms.Platform.Android.AppCompat.FrameRenderer
    {
        public ShadowFrameRenderer(Context context) : base(context)
        {
        }
        protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null && e.NewElement is ShadowFrame)
            {
                Elevation = 30.0f;
                TranslationZ = 0.0f;
                SetZ(30f);
                //this.SetBackgroundResource(Resource.Drawable.shadow);
                //GradientDrawable drawable = (GradientDrawable)this.Background;
                //drawable.SetColor(Android.Graphics.Color.ParseColor("#F0F0F0"));
            }
            UpdateElevation();
        }


        private void UpdateElevation()
        {
            //var materialFrame = (ShadowFrame)Element;

            // we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
            if(Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            Control.StateListAnimator = new Android.Animation.StateListAnimator();

            // set the elevation manually

                ViewCompat.SetElevation(this, 10);
                ViewCompat.SetElevation(Control, 10);
            if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                Control.Elevation = 10;
                Control.CardElevation = 10;
            }

        }

        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            UpdateElevation();
            //if (e.PropertyName == "Elevation")
            //{
            //    UpdateElevation();
            //}
            }

Xamarin Shell Flyout menu greyed content

$
0
0

Hi,
I have a xamarin shell application with a flyout menu.

When I open the menu inside the iOS application the right content isn't greyed.
In the Android application this is the default behavior.

On iOS, I would like to have the same behavior as Android.

Here the Xaminals application as example.

Android
Android

iOS
iOS
Anyone can help me?

Thank you!


Best practice approach - Writing captured graphic file to a server

$
0
0

I've received very useful help from this forum, for which I'm grateful. I have a prototype app. which is operational in every respect, other than transferring files below from the device to a server, to enable office staff to be able to pick them up:

  1. Small line of captured text.
  2. A captured signature PNG file.
  3. An optional JPG image file.

I've looked into Restful services and JSON. Up to now, for loading data into my prototype, I've developed my own method by reading content from pages on our hosted web server, using httpClient.GetStringAsync(" "). I designed the protocol for this, but in time I'll no doubt re-develop it, although it works fine.

I can't use this approach for getting the above 3 items back to a server and I'm unfamiliar in regard to what might be the best practice. I've been reviewing some samples such as this recent one on the forum, which uses client.PostAsync(url, content) Unfortunately it points to a broken link.

Would I be correct in thinking we'd need to write our own code at the server end, for instance in PHP, to capture this POST data? Or is there a simpler way (or an existing way) that can make use of common services within popular hosting plans, such as MySQL etc? We don't really need to do anything especially sophisticated with this data, just that it needs to be accessible in some way. Thanks for any suggestions.

Octane VideoPlayer not playing video in Android version 9

$
0
0

Hello Xamariners,
I install Octane.Xam.VideoPlayer v3.1.0 for play video in CollectionView but this plugin is not playing video in Android Version 9.
I Checked android version 5, 7, and 8, Videos are playing

**This is my implemented **
I initialize this FormsVideoPlayer.Init(); in MainActivity class

This i my model class

public class MainModel : BaseViewModel
    {
        public double id { get; set; }
        public string video_url { get; set; }
    }

This is my ViewModel class

public class MainViewModel : BaseViewModel
    {
        public MainViewModel()
        {
            main_list = new ObservableCollection<MainModel>
            {
                new MainModel
                {
                    id = 1,
                    video_url ="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
                },
                new MainModel
                {
                    id = 2,
                    video_url ="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",
                },
                new MainModel
                {
                    id = 3,
                    video_url ="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
                },
                new MainModel
                { 
                    id = 4,
                    video_url ="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",
                },
            };
        }

        private ObservableCollection<MainModel> _main_list;
        public ObservableCollection<MainModel> main_list
        {
            get { return _main_list; }
            set
            {
                _main_list = value;
                OnPropertyChanged("main_list");
            }
        }
    }

This is My Xaml Code

<CollectionView ItemsSource="{Binding main_list}"
                                          VerticalOptions="FillAndExpand"
                                          ItemSizingStrategy="MeasureAllItems"
                                          SelectionMode="Single"
                                          ItemsUpdatingScrollMode="KeepItemsInView">
                <CollectionView.ItemsLayout>
                    <LinearItemsLayout Orientation="Vertical"
                                       SnapPointsType="MandatorySingle"
                                       SnapPointsAlignment="Start"/>
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Grid HorizontalOptions="FillAndExpand"
                              VerticalOptions="FillAndExpand"
                              BackgroundColor="{Binding background_color}">
                            <o:VideoPlayer Source="{Binding video_url}"
                                           AutoPlay="True"
                                           FillMode="ResizeAspect"
                                           DisplayControls="False"
                                           Failed="VideoPlayer_Failed"/>
                        </Grid>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
                <CollectionView.EmptyView>
                    <StackLayout BackgroundColor="Transparent">
                        <Label Text="No video found!"
                               FontSize="Large"
                               FontAttributes="Bold"
                               HorizontalOptions="CenterAndExpand"
                               VerticalOptions="CenterAndExpand" />
                    </StackLayout>
                </CollectionView.EmptyView>
            </CollectionView>

This is my Xaml.cs page

    public partial class MainView : ContentView
    {
        MainViewModel viewModel;
        CommentView comment;
        public MainView()
        {
            try
            {
                InitializeComponent();

              BindingContext = viewModel = new MainViewModel(btn.Height);
            }
            catch (Exception ex)
            {
            }
        }

        private void VideoPlayer_Failed(object sender, Octane.Xamarin.Forms.VideoPlayer.Events.VideoPlayerErrorEventArgs e)
       {
        }
    }

Summary

CollectionView Loaded then VideoPlayer_Failed but not showing any message on this method

any additional code for Android Version 9?

Export sqlite db to a user's choice location on a device and import db file

$
0
0

I am using Xamarin to create a database if none existing.
public partial class App : Xamarin.Forms.Application
{ static BusinessDB database;
public static BusinessDB Database
{get {
if (database == null)
{database = new BusinessDB(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BusinessDB.db3"));}
return database; } }

The Xamarin program then creates, updates, and uses tables in this SQLite database as needed.

I am wanting to create a Backup/ Import page that allows users to upload a database or download a database backup. When uploading a database that may have a name different than BusinessDB, such as Backup01012020CompanyXDB.db3, what should I do?

I want the user to have an option of where to save a backup, and also the ability to pick a database for import. Is there simple cross platform code suitable for this?

I am a newbie, but so far I am loving learning :)

Multiline picker on iOS

$
0
0

I noticed that by default in picker on iOS when text is too long, it is truncated and it ends with three dots (...).

How can I make a picker on iOS multiline? I guess that I probably need a custom renderer but can someone explain how to write it, because I am not very good at iOS API (Swift, Objective-C, etc.)

ListView inside CarouselView scroll vertical is almost impossible.

$
0
0

I have a collection of listviews inside a horizontal CarouselView. When im trying to scroll vertically through the listview in focus, if make any tiny movement horizontally, the carousels horizontal scrolling "takes over" and makes scrolling vertically almost impossible. Anyway i can "prioritize" the listviews scrolling?

Hope it makes sense :)

Viewing all 79144 articles
Browse latest View live