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

[xfx combox] Dynamically insert an item that doesn't exist in the ItemSource

$
0
0

So the list contains elements: ["Company1", "Company2", "Company3"].

When the user's start typing, the popup shows up with those elements. However, I want user to be able to insert the new item: "Company4", but the user is not able to do it!


SetFlag not work in android?

$
0
0

The class, property, or method you are attempting to use ('.ctor') is part of IndicatorView; to use it, you must opt-in by calling Forms.SetFlags("IndicatorView_Experimental") before calling Forms.Init().

but in the ManActivity.cs I have set the flag:
`base.OnCreate(savedInstanceState);

        global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
        global::Xamarin.Forms.Forms.SetFlags("IndicatorView_Experimental");
        Xamarin.Essentials.Platform.Init(this, savedInstanceState);
        global::Xamarin.Forms.Forms.Init(this, savedInstanceState);`

it still give an error?

BindingSource of control changes when added into a view

$
0
0

I am trying to set a binding in C#. It's initialised once properly and then I get a warning that the control is looking into a different ViewModel for the property and does not update.
Is my view somehow overwriting the binding context of the control that I set in C#, if so how can I tell it to keep i'ts binding?

It does not seem to happen for controls that are binded in xaml

How do I solve the Unable to figure out route for: // in Xamarin Shell Flyout menuItems?

$
0
0

I have created the Flyout menuItems below. In this particular order.

                         <FlyoutItem Shell.TabBarIsVisible="False" Route="header"  FlyoutDisplayOptions="AsMultipleItems">
            <ShellContent x:Name="BookItItem" Route="bookit" Title="BOOK IT" ContentTemplate="{DataTemplate views:HomePage}" />
            <ShellContent x:Name="ExploreItem" Route="explore" Title="EXPLORE" ContentTemplate="{DataTemplate subs:ExplorePage}" />
            <ShellContent x:Name="ContactItem" Route="contact" Title="CONTACT" ContentTemplate="{DataTemplate login:ContactPage}" />
        </FlyoutItem>

         <FlyoutItem Shell.TabBarIsVisible="False" Route="main" FlyoutDisplayOptions="AsMultipleItems">
            <ShellContent x:Name="MyReservationsItem" Route="reservation" Title="MY RESERVATIONS" ContentTemplate="{DataTemplate            reservations:MyReservationsPage}" />
            <ShellContent x:Name="MyGuestItem" Route="guest" Title="MY GUESTS" ContentTemplate="{DataTemplate guests:MyGuestsPage}" />
            <ShellContent x:Name="OverViewItem" Route="account" Title="OVERVIEW"  Icon="" ContentTemplate="{DataTemplate settings:OverViewPage}" />
            <ShellContent x:Name="PasswordSecurityItem" Route="password"  Title="PASSWORD &amp; SECURITY" ContentTemplate="{DataTemplate settings:PasswordSecurityPage}" />
            <ShellContent x:Name="EmailPreferencesItem" Route="email" Title="EMAIL PREFERENCES" ContentTemplate="{DataTemplate settings:EmailPreferencesPage}"  />
        </FlyoutItem>

However, the requirement based on certain conditions, is for the landing page to be the ExplorePage.

In the AppShell I have set it like so.

        public AppShell(string pageName)
                {
                    InitializeComponent();
                     Routing.RegisterRoute("explore", typeof(ExplorePage));
                          if( pageName == “explore”)
                          {
                              this.CurrentItem = this.Items[0].Items[1];
                                      this.CurrentItem.Style = (Style)this.Resources[“MainShell"];
                                      ExploreItem.SetValue(FlyoutBackgroundColorProperty, Color.Blue);
                          }
                }

It lands on that page, the FlyoutBackgroundColor does not change to blue, meaning it doesn’t highlight the row on the flyout menu item list.
When I click on the same Explore MenuItem, it throws an exception.
Error Message : Unable to figure out route for: //

I set the FlyoutDisplayOptionsProperty to "AsMultipleItems" to group the items such that the separator separates the groups.

I added the
Routing.RegisterRoute("explore", typeof(ExplorePage)); to the constructor with the hope that would resolve the problem but it hasn't.

How do I solve this problem?
Unable to figure out route for: //

WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS

$
0
0

Hi,

I have a problem with WebView. Some websites couldn't view like below;

as I understand, the solution is below but where can I set the usesCleartextTraffic as true in Xamarin webforms?

Masonry list style in Xamarin

$
0
0

I need to list the announcements on a content page just like masonry style (https://halcyon-theme.tumblr.com/) but I couldn't be successful on it. My problem is that the Scrollview doesn't cover whole the page when I use the Parent Stacklayout's Vertical alignment option set as FillAndExpand. But if I set the Scrollview and Parent StackLayout as static height value, It's okay but due to per item's height will change, I can't use it that's the way as you guess.

 <StackLayout x:Name="stckParent" Orientation="Vertical" VerticalOptions="FillAndExpand">
                    <Grid VerticalOptions="FillAndExpand" RowSpacing="0" ColumnSpacing="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>

                        <StackLayout x:Name="stckLeft" Grid.Column="0" Margin="0,0,2,0"
                                  Orientation="Vertical" VerticalOptions="FillAndExpand">
                        </StackLayout>

                        <StackLayout x:Name="stckRight" Grid.Column="1" Margin="2,0,0,0"
                                  Orientation="Vertical" VerticalOptions="FillAndExpand">
                        </StackLayout>

                    </Grid>
                </StackLayout>

</ScrollView>


public MainPage()
        {
            InitializeComponent();

            var list = new ObservableCollection<Announcement>
            {
                new Announcement
                {
                    ID = 1,
                    Title = "Yedek parça siparişlerinizde %22' ye varan indirim!",
                    ImagePath = "https://image5.sahibinden.com/photos/08/54/18/x5_719085418j7p.jpg",
                    IsActive = true,
                    CreateDate = DateTime.Now,
                },
                new Announcement
                {
                    ID = 2,
                    Title = "Fren Balataları Hangi Sıklıkla Değiştirilmelidir?",
                    ImagePath = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTJzQfduSrJ3Nh7SHzGSGrCmTnWses4AcfuRSnU7hX4y9XN4TSU&usqp=CAU",
                    IsActive = true,
                    CreateDate = DateTime.Now,
                }
            };

            DeviceHelper helper = DependencyService.Get<IDeviceHelper>().GetDevice();

            double height = 0;

            for (int m = 0; m < 6; m++)
            {
                for (int i = 0; i < list.Count; i++)
                {

                    Frame frame = new Frame
                    {
                        Padding = new Thickness(0, 0, 0, 0)
                    };

                    // Stack
                    StackLayout stack = new StackLayout
                    {
                        Margin = new Thickness(10),
                    };

                    // Image
                    Image image = new Image
                    {
                        Source = list[i].ImagePath,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand
                    };

                    // Title
                    Label title = new Label
                    {
                        Text = list[i].Title,
                        Margin = new Thickness(0, 6, 0, 0),
                        FontSize = 13
                    };

                    // Date
                    Label date = new Label
                    {
                        Text = list[i].CreateDate.ToString().Substring(0, 10), // temporary workaround
                        Margin = new Thickness(0, 6, 0, 0),
                        TextColor = Color.Gray,
                        FontSize = 11
                    };

                    stack.Children.Add(image);
                    stack.Children.Add(title);
                    stack.Children.Add(date);

                    frame.Content = stack;


                    if (i % 2 == 0)
                    {
                        stckLeft.Children.Add(frame);
                    }
                    else
                    {
                        stckRight.Children.Add(frame);

                        SizeRequest columnSizeRequest = frame.Measure(600, 800);
                        height += columnSizeRequest.Request.Height * 6; // *6 is estimated height, what should be the solution?
                    }
                }
            }
            stckLeft.HeightRequest = height;
            stckRight.HeightRequest = height;

            scrList.HeightRequest = helper.ScreenHeight - 100;

        }

Why Scrolview doesn't fill the whole page?
What is the best practice to able to do the masonry-style page?

How can I obtain a frame size that just bound? {
SizeRequest columnSizeRequest = frame.Measure(300, 400); // the result is always 41, It's not make sense..
height += columnSizeRequest.Request.Height * 6;

}

except for estimated height value, not bad :)

GitHub link; https://github.com/Erdogan34/Test-Masonry

thanks

Unexpected Memory leaks shown by Xcode's Instrument tool

$
0
0

Hi,
I have a problem related to memory leaks shown by Xcode's Instrument tool.

I have used Visual Studio 2017 on windows 7 machine connected to mac build host.

I have created Xamarin project in Visual Studio 2017 as follows:

File->New->Project->Cross-Platform->Mobile App(Xamarin Forms)->Blank(iOS, .NET Standard)
Note: I have added No extra code from my side

This project is successfully executed on iPhone5s Simulator (12.1)

Then i used instrument tool (Leak Check)

It showed following leaks.

Question: Why these leaks occur on standard project and How to fix them.

Image-1

Image-2

Image-3

Image-4

Image-5_1

Image-5_2

Image-6

Image-7

This project references NuGet package(s) that are missing on this computer

$
0
0

Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ....\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets


Xamarin forms android rendering problem in xaml preview

$
0
0

I have the following problem with the latest Visual studio 2019 for Mac. I get error for all android xaml previews
System.ArgumentException: An item with the same key has already been added. Key: Android.Support.V4.Media.Session.MediaSessionCompat+IOnActiveChangeListenerImplementor at System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x002b5] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:677
at System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:240 at Xamarin.AndroidDesigner.Java.JcwWrapperGenerator.GenerateAsync () [0x001b5] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Java/JcwWrapperGenerator.cs:32 at Xamarin.Designer.Tasks.WhenBoth[T1,T2] (System.Threading.Tasks.Task1[TResult] task1, System.Threading.Tasks.Task1[TResult] task2) [0x0003b] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer/Xamarin.Designer/TaskExtensions.cs:112 at Xamarin.AndroidDesigner.DesignerProject.SynchronizeAssemblies (System.Boolean firstSync) [0x001f1] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/DesignerProject.cs:1814 at Xamarin.Designer.Telemetry.TimingTaskExtensions.AsTimedOperationInternal (System.Threading.Tasks.Task originalTask, System.String eventName, Xamarin.Designer.Telemetry.ITelemetryCorrelation correlation, Xamarin.Designer.Telemetry.TelemetryProperties properties, Xamarin.Designer.Telemetry.ITimingReporter reporter, System.Boolean sendToTelemetry) [0x000d5] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer/Xamarin.Designer/Telemetry/DesignerTelemetry.cs:240 at Xamarin.AndroidDesigner.DesignerProject.InitializeIdeProjectAsync () [0x005e4] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/DesignerProject.cs:199 at Xamarin.AndroidDesigner.AndroidDesignerService.LoadProjectAsync (Xamarin.AndroidDesigner.IIdeProject ideProject, System.String resourcesDir, System.String projectResourcesDir) [0x00069] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/AndroidDesignerService.cs:540 at Xamarin.AndroidDesigner.MonoDevelop.AndroidProjectWrapper.FromProjectAsync (Xamarin.AndroidDesigner.AndroidDesignerService service, MonoDevelop.Projects.Project project) [0x00097] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner.MonoDevelop/AndroidProjectWrapper.cs:102 at Xamarin.Designer.Forms.XamarinStudioXamlPreviewerView.InitializeAndroidDesignerProject (MonoDevelop.Projects.DotNetProject androidProject) [0x00030] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.FormsPreviewer.MonoDevelop/Xamarin.Designer.Forms/XamarinStudioXamlPreviewerView.cs:575 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.EnsureAndroidIsReady () [0x00078] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:90 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.RenderOneXaml (MonoTouch.Design.XamlRenderContext context) [0x0004b] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:129 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.RenderXamls (MonoTouch.Design.XamlRenderContext context, System.Threading.CancellationToken token) [0x003c1] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:293

I have no problems with the iOS version. Does anyone know why this is displayed?

How to get the current page in a Shell?

$
0
0

I have a Shell based app. When I respond to a push notification I want to handle it differently depending on which page the user is currently viewing. How can I get the current page?

I've found that Shell.Current.CurrentState.Location tells me the route of the current page. But, in addition to that, I would like to get the Page object. The reason is, in one case, in response to the notification, I would like to refresh the page. That page (or it's BindingContext) has that refresh functionality, but in order to execute it I need to get that Page object. How can I get that?

I believe that one way would be to listen to the Shell navigation events and keep track, but that seems like overkill. Surely there must be a simple way to determine the current page.

Thanks.

Cannot create an IOS archive.

$
0
0

Helllo i have trouble with IOS archive. When i debug on simulator all was ok but when i trying to create a relese i have error "Cannot create an IOS archive 'xxx'. Process cannot be executed on XMA server."dsymutil"exited with code 1." I attach log from build.

How can i Advertise multiple ble data with time interval and stop and start advertising as i want?

$
0
0

I am creating a BLE advertising tag in android, which I want to transmit every 10 sec likewise, I want to create multiple BLE tags.
and also I want to give the option to start and stop advertising as the user wants. I am Sharing my main advertising code. suggest any solution for it

using Android.Bluetooth.LE;
using Android.Bluetooth;
public string StartTransmittingData(string tagdata)
{
BluetoothLeAdvertiser leAdvertiser = BluetoothAdapter.DefaultAdapter.BluetoothLeAdvertiser;

        AdvertiseSettings settings = (new AdvertiseSettings.Builder())
                                                .SetConnectable(true)
                                                .SetAdvertiseMode(AdvertiseMode.LowLatency)
                                                .SetTxPowerLevel(AdvertiseTx.PowerMedium)
                                                .Build();

            var mfrid = Convert.ToInt32(("fffe"), 16);
            byte[] raw = tagdata;
            AdvertiseData advertiseData = (new AdvertiseData.Builder())
                                         .SetIncludeDeviceName(true)
                                         .AddManufacturerData(mfrid, raw)
                                         .Build();

            BleAdvertiseCallback callback = new BleAdvertiseCallback();


            leAdvertiser.StartAdvertising(settings, advertiseData, callback);

            return callback.ToString();

    }

Xamarin Forms and Azure - Easy table gone

$
0
0

Hi,
Need help and advice. Last month, my Azure resources removed for some unknown reason and Microsoft were not able to explain what happened.

Anyway, We got everything back but the app cannot communicate with SQL server. We checked everything and all is fine except one issue!
I initially used Easy Table that made it so easy to setup Mobile App on Azure platform. Microsoft removed Easy Table and it is not accessible. I cannot find any new documentation to explain how to resolve it. I don't have experience in node.js.

When I use postman to test the connection and data, I get the following error message:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Has anyone experienced it? Any solution?

Thank you for your help in advance.

Kind regards,
Kamal

iOS app rejected: "Safety: User Generated Content"

$
0
0

Hello,
after adding the ability for users to message each other in our app, the binary was rejected for these reasons:
Hello,

Regarding 1.2.0 - EULA, flagging, & blocking mechanism, we are referring to the capability that allows users to message each other.

To resolve this issue, it would be appropriate to revise your app to implement all of the following precautions:

  • Require that users agree to terms (EULA) and these terms must make it clear that there is no tolerance for objectionable content or abusive users
  • A method for filtering objectionable content
  • A mechanism for users to flag objectionable content
  • A mechanism for users to block abusive users
  • The developer must act on objectionable content reports within 24 hours by removing the content and ejecting the user who provided the offending content

We look forward to reviewing your resubmitted app.

Best regards,

App Store Review

Now, it sounds like they want us to implement a way to block users and to add a EULA agreement.
But i am not sure what they want (I replied asking clarification, and they replied with the same message, duh!):

  1. EULA: where should i make the EULA available? After logging-in we have a menu and I can add it there. Should i also add a link to the EULA page in the registration page? Or in the login page? Some say "show it during installation", but how can you do that?
  2. A method for filtering objectionable content: we're far from AI.....but our admins can remove content from the backend, is that enough?
  3. The developer must act on objectionable content reports within 24 hours....: same as #2

Thanks to anyone who has been there done that and can help me understand!

Detect BLE characteristic value change

$
0
0

I have to migrate iOS app (that uses BLE) to cross platform app.

I am using Plugin.BLE to connect to a device. I want to detect characteristic's value changes, so I use await characteristic.StartUpdatesAsync() method and characteristic.ValueUpdated event. When I call StartUpdatesAsync() method I can see that ValueUpdated event is handled continuously, even if the value doesn't change.

Is this correctly working?


How to make a connection to MS Sql Server from Xamarin.Android?

$
0
0

Hi everyone!
I have a question: how can I make a connection to a DB that is on SQL Server on my computer?
I've already enabled SQL Browser and used System.Data.SqlClient, however a program threw such mistake:

Can you please tell me, how can I fix it? Maybe I should use another NuGet, but I don't know which one....

API Rest

$
0
0

What is the best way to create an api rest in xamarin forms

Does custom renderer control inherit Base properties?

$
0
0

Hello,

I am using https://github.com/XamFormsExtended/Xfx.Controls "Custom entry control". I am trying to set MaxLength and IsReadOnly properties of entry on "Custom entry control" but those properties are not active on control and I ain't getting desired result.
How can function those base properties to work with custom renderer?

¿como conectar un web service?

$
0
0

Buen día, he estado tratando de realizar una conexión a mi web service pero he tenido los siguientes errores:

  1. Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
    Error CS0006 No se encontró el archivo de metadatos 'C:\Users\juan.corona\source\repos\Intentos\cursoxamarin\cursoxamarin\cursoxamarin\bin\Debug\netstandard2.0\cursoxamarin.dll' cursoxamarin.UWP C:\Users\juan.corona\source\repos\Intentos\cursoxamarin\cursoxamarin\cursoxamarin.UWP\CSC 1 Activo

  2. Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
    Error Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.' cursoxamarin.UWP C:\Users\juan.corona\source\repos\Intentos\cursoxamarin\cursoxamarin\cursoxamarin.UWP\cursoxamarin.UWP.csproj

  3. Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
    Error Position 9:47. EventHandler "btn1_Click" not found in type "cursoxamarin.MainPage" cursoxamarin C:\Users\juan.corona\source\repos\Intentos\cursoxamarin\cursoxamarin\cursoxamarin\MainPage.xaml 9

Si alguien me pudiera ayudar se los agradeceria mucho

Saludos.

Center app logo using TitleView

$
0
0

Hello folks! Hope you are doing great!

Im trying to center my app logo using TitleView but it's impossible to achieve that when I have the arrow icon in the nav bar.

Some code:

Anyone know how to solve this?

Viewing all 89864 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>