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

dropdown list text being cut

$
0
0

i dont know if its ok to ask here but i dont know where to ask this question.
i having a problem with autosuggestbox nugget from morten

https://www.nuget.org/packages/dotMorten.Xamarin.Forms.AutoSuggestBox

dropdown list being cut on the end of text.

heres my code :

entry = new AutoSuggestBox
{
PlaceholderText="suggest",
PlaceholderTextColor= Color.Blue,
};

        entry.DisplayMemberPath = "text";
        entry.TextChanged += Entry_TextChanged;

tableDataResult = new List {
new tableData { code = 0, text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio"}, };

private void Entry_TextChanged(object sender, AutoSuggestBoxTextChangedEventArgs e)
{
AutoSuggestBox box = (AutoSuggestBox)sender;
box.ItemsSource = GetSuggestions(box.Text);
}

private List GetSuggestions(string text)
{
return string.IsNullOrWhiteSpace(text) ? null : tableDataResult.Where(s => s.text.StartsWith(text, StringComparison.CurrentCultureIgnoreCase)).ToList();
}

can someone help me?
thanks in advance


Is the ListViewCachingStrategy, RecycleElement, buggy ?

$
0
0

Hi there,

I have been working on a project for long time now with a few persons and among all the features, the user can search for another one through a listing. We are using Xamarin's ListView control and we optimized its performance by setting the ListViewCachingStrategy as RecycleElement. So far everything was working perfectly fine and we improved our timing response by using ElasticSearch on the backend's side.

We were only displaying the users' informations and allowing the connected user to open someone else's page by tapping on the needed cell. The thing is that we recently implemented a new feature allowing him / her to open a second control over the list through a button located itself into the cell. To do so, we set a Command into our UserViewModel initializing everything we need and setting the bool that is binded to this new control's IsVisible property, but when this one is trigger (the Command) we are not into the UserViewModel that is corresponding to the user we wanted.

To be more precise, this issue is only showing up after the first six users (the first ones that are being displayed once the page is appearing) and if we scroll down, the users' informations are being updated correctly so in theory by tapping the button we should trigger the command into the wanted user's ViewModel, right ? Yet, it's not the case since we will always end up into one of the first six UserViewModels...

I have been looking on Google if someone went through the same issue, but none of the results were similar to mine, but I did understand that the RecycleElement is facing some issue on Android. My question is naturally: is it still the case ? If not: did someone face a similar issue ?

Also, our ListView's itemSource is a simple List and not an ObservableCollection as some people may advice to use. Could it lead to such problem ?
I hope that my explanations were clere enough and if you need any details, let me know about it. I really would like to debug this situation...

Thank you in advance to anyone who will read my post and who will take the time to respond to it.
Best regards,

MT WSM

How to get Firebase token after user Login?

$
0
0

Here i am getting firebase id token ,and it works fine-
public async override void OnTokenRefresh()
{
refreshedToken = FirebaseInstanceId.Instance.Token;
SendRegistrationToServer(refreshedToken);
}

but how to generate this token only when user login to the app(after click on login button)?
give me sample code for do this.

Toolbar - issues with setting background color to white

$
0
0

I am trying to set the background color of a toolbar to white. However, when I do that, the back arrow and text of toolbar items remain white and invisible.
How can I change their color?

Super Fast Image Loading for Android Apps with GlideX issue

Video from local storage not playing in WebView (Xamarin.Forms) after latest iOS update (12.2)

$
0
0

I have an existing Xamarin Forms application, for Android and iOS, which shows some HTML content from local storage (the purpose is to view this content while offline) in WebView.

After the latest iOS update (12.2), the videos in that HTML stopped working. White background is shown on the place of the video, with the symbol "Play" but no action is possible.

I have tried changing the video tag to include autoplay, mute, but no success.

Xamarin Forms: Load a contentpage when tap push notification android

$
0
0

I completed receiving test notification from FCM console. Now I am trying to open a page when tapping the notification. Any ideas about how to achieve this? I have searched the internet but can't find a working solution. I am also able to send the notification through the postman.

How to create pdf set list to pdf and download pdf when press download button

$
0
0

when i click download button , webservice data list show in pdf format ,create pdf and download pdf using xamarin forms


How to change Title font for Navigation bar ?

$
0
0

Can't find place where to change font for Navigation page title.
Is there ability to do it ?

ImageButton Source Binding problem

$
0
0

Hi

I am using Image Button with this code:

        ImageButton imageButtonStampa = new ImageButton() { Style = (Style)Application.Current.Resources["imageButtonStyle"] };
        imageButtonStampa.SetBinding(ImageButton.CommandProperty, "StampaCommand");
        imageButtonStampa.SetBinding(ImageButton.IsEnabledProperty, new Binding("NewBarcode", converter: new IsNotNullToBooleanConverter()));
        imageButtonStampa.SetBinding(ImageButton.SourceProperty, new Binding("NewBarcode", converter: new IsNotNullToSourceConverter(), converterParameter: stampaSources));

First time I open the page I have this:

Then I insert some data, IsNotNullToSourceConverter fires and Source changes:

Now, when I press the ImageButton, I send some data to a bluetooth printer.

        StampaCommand = new Command(async () => {
            try
            {

                if (_isTapped)
                    return;

                _isTapped = true;

                await Util.Print.PrintBarcode(Preferences.GetPrinterBarcode(), NewBarcode);

                _isTapped = false;
            }
            catch (Exception ex)
            {
                _isTapped = false;
                await Application.Current.MainPage.DisplayAlert(AppResources.Attenzione, ex.Message, AppResources.Ok);
            }
        });

But I have this problem:

and when print is finished, the problem remains:

If I rotate the screen, problem disappears:

What can I do for this?

@DavidOrtinau

Thanks
Alessandro

Got a SIGABRT while executing native code. (Since latest updates on Mac, OS and XCode) 2019-04-10

$
0
0

All apps do this including ones deployed earlier (monday) this week (pre updates)
semaphore.h:90:8 [opt]
frame #8: 0x00000001101ad54a mlaunchfinalizer_thread at mono-coop-semaphore.h:43 [opt] frame #9: 0x00000001101ad53e mlaunchfinalizer_thread(unused=) at gc.c:903 [opt]
frame #10: 0x00000001102674f9 mlaunchstart_wrapper_internal(start_info=<unavailable>, stack_ptr=<unavailable>) at threads.c:1098:3 [opt] frame #11: 0x0000000110267357 mlaunchstart_wrapper(data=0x00007fd94b43ec60) at threads.c:1158:8 [opt]
frame #12: 0x00007fff5bb212eb libsystem_pthread.dylib_pthread_body + 126 frame #13: 0x00007fff5bb24249 libsystem_pthread.dylib_pthread_start + 66
frame #14: 0x00007fff5bb2040d libsystem_pthread.dylib`thread_start + 13

(lldb) detach

Got a SIGABRT while executing native code. This usually indicates
used by your application.

a fatal error in the mono runtime or one of the native libraries

(lldb) quit
Process 2472 detached
Would really appreciate some help, I'm loosing so much time over this and beginning to feel Xamarin is really not worth the pain
Rebooted all several times, tried several apps that were working fine before (no changes in code)

MasterDetailPage ActionBar test with UITest?

$
0
0

Hello,

I have an application that user MaterDetailPage as the root page. I want to open the side menu by tapping the menu icon in the action bar. However, when I type in 'tree' in Repl I do not see the action bar items listed. Is there an approach that would allow me to interact with the action bar items using UITest or must I use the TapCoordinates(x,y) to do that?

Also, how would I set the StyleID for the 'side menu button'?

Best Regards,
Vilius

Application.Current.Properties is Empty when app close

$
0
0

I'm using Xamarin Forms I have two method to authenticate user :

1 : the user enter username and password

2 : the user can authenticate with their Office 365 account .

for the first method when the user enter his username and password and check if username and password existe ...
i do this :

                        var app = Application.Current as App;
            app.Properties["logged"] = "true";

when closing the app and open it

App.cs

        if (this.Properties.ContainsKey("logged") && this.Properties["logged"].ToString() == "true")
        {
            MainPage = new NavigationPage(new MasterMenuPage());
        }
        else
        {
            if (this.Properties.ContainsKey("currentConfig"))
            {
                MainPage = new NavigationPage(new AuthentificationPage());
            }
            else
            {
                MainPage = new NavigationPage(new ChoixEcole());
            }
        }

protected override void OnStart()
{
// Handle when your app starts
Console.WriteLine("OnStart Method logged 1--> " + Application.Current.Properties.ContainsKey("logged"));
Console.WriteLine("OnStart Method logged 2--> " + this.Properties["logged"].ToString());
} 

Console :

OnStart Method logged 1--> True
OnStart Method logged 2--> true

Automatically the main page is shown

same thing for Office but i always go back to the Authentification Page and Application.Current.Properties.ContainsKey("logged"). is false

 var app = Application.Current as App;
 app.Properties["logged"] = "true";

Console :

OnStart Method logged 1--> False

it's the same logic buy i can not understand why a lose information when i login with office account.

The "LinkAssemblies" task failed unexpectedly error while building the application

$
0
0

Hi,

I'm getting the below error while building the application using linking SDK assemblies option and with out shared runtime (as shared run time causing error while release the application.)


Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void System.Net.Http.HttpClientHandler/c__async0::MoveNext()' in assembly: 'System.Net.Http.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Net.WebHeaderCollection::AddValue(System.String,System.String)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() D:\Program Files\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1577

if shared runtime option is unchecked and link option none httpclient.GetStringAsync() method will raise the following error
Method 'System.Net.WebHeaderCollection.AddValue' not found.

but application is working fine when the shared runtime option is ticked and 'SDK assemblies only' link option selected in the android options tab.
I could find lot of similar threads but couldn't find any solution for this one.

Thanks,
Eins

Convert Xamarin.Forms.View to UIView

$
0
0

I need to create a bitmap from a view, like a stack layout for example. Is that possible in iOS? I 've done it in Android already ,using a custom render, but I'm struggling in iOS.
Does anyone have an ideia if that's possible?


Problem when publishing an application on the App Store [Non-public API usage]

$
0
0

Hi all,

Until three weeks ago, my application could upload it to the App Store without any problem. However, Apple has refused to upload the app with this new message::

Non-public API usage:

The app references non-public selectors in AppAytoSS.iOS: addTemporaryAttribute:value:forCharacterRange:, addTemporaryAttributes:forCharacterRange:, behaviorWithType:, defaultBaselineOffsetForFont:, defaultLineHeightForFont:, finished, greekingThreshold, horizontalCornerRadius, initWithSource:convolutionState:weights:, initWithType:, postSession:didAddPlayer:, postSession:didReceiveData:fromPlayer:, postSession:didReceiveMessage:withData:fromPlayer:, postSession:didRemovePlayer:, postSession:player:didChangeConnectionState:, postSession:player:didSaveData:, preferredMetalContext, removeData:, removeTemporaryAttribute:forCharacterRange:, setGreekingThreshold:, setHorizontalCornerRadius:, setIsPrimary:, setShouldAntiAlias:, setUUID:, setVerticalCornerRadius:, shouldAntiAlias, temporaryAttribute:atCharacterIndex:effectiveRange:, temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:, temporaryAttributesAtCharacterIndex:effectiveRange:, temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:, textContainerChangedTextView:, toolTip, usesBackgroundSession, verticalCornerRadius

The application is developed with ****Xamarin in Visual Studio for Mac**** and has updated all the libraries and packages. Can anybody help me? Because I can not find what the problem is, nor do I see any solution. It will be something new?

Thank you all.

Android: Could not load assembly 'xxx' during startup registration

$
0
0

I'm trying Syncfusion (charts) and in the Android project after deploying I get

Assembly Loader probing location: 'Syncfusion.SfAutocomplete.XForms.Android'.
Could not load assembly 'Syncfusion.SfAutocomplete.XForms.Android' during startup registration.
This might be due to an invalid debug instalation.
A common cause is to 'adb install' the app directly instead of doing from the IDE.

I readded the reference but that didn't help. Furthermore I tried to disable fast deployment without success. How can I find out what the cause is? Building the app works fine.

Android accessibility Font Sizes - how it affects forms

$
0
0

Similar to this question:
http://stackoverflow.com/questions/19817086/device-settings-independent-font-size

I got my app to fit and look good on phones and tablets, then to my horror I discovered that if the Android accessibility Font Size was increased my app wouldn't fix on some phones.

Is there any strategy to mitigate this? In my forms I uses the forms Fonts:
FontSize = "Large" FontSize = "Medium"
...etc

Can I force the app to always uses constant sizing - regardless of the Android accessibility Font Size?

Smooth scroll to position when ListView SelectedItem changed

$
0
0

Summary

Automatically scroll the ListView to the selected position when SelectedItem property is changed.
Works on iOS, but not implemented on Android or UWP.

API Changes

Update ListView renderers for Android and UWP.
We have already built this functionality using custom renderers. If approved, can create a PR.

Intended Use Case

Unify the UI behaviour across all three platforms.

how to off nestedscrolling in listview inside scrollview in xamarin forms

$
0
0



<ListView
x:Name="pasengerlist"
SelectionMode="None"
VerticalOptions="FillAndExpand"

                    BackgroundColor="White"
                    HasUnevenRows="true">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell
                                x:Name="            "
                                  >
                                <StackLayout
                                    Margin="5"
                                    Orientation="Vertical"
                                    VerticalOptions="FillAndExpand"
                                    HorizontalOptions="FillAndExpand">
                                    <Label
                                        Text="{Binding PaxNo}"
                                        TextColor="Red"
                                        FontSize="Micro" />
                                    <StackLayout
                                        Margin="10"
                                        Orientation="Horizontal"

                                        VerticalOptions="CenterAndExpand">
                                        <StackLayout
                                            Orientation="Vertical"
                                            HorizontalOptions="StartAndExpand">
                                            <Label
                                                Text="FIRST NAME"
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                BorderColor="Gray"
                                                CornerRadius="0"
                                                Padding="0"
                                                HasShadow="false">
                                                <Label
                                                    x:Name="fromname"
                                                    Text="{Binding FirstName}"
                                                    BackgroundColor="Transparent"
                                                    Margin="5"
                                                    FontSize="Micro"
                                                    TextColor="Black" />
                                            </Frame>
                                        </StackLayout>
                                        <StackLayout
                                            Orientation="Vertical"
                                            HorizontalOptions="CenterAndExpand">
                                            <Label
                                                Text="LAST NAME"
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                BorderColor="Gray"
                                                HasShadow="false"
                                                Padding="0"
                                                CornerRadius="0">
                                                <Label
                                                    x:Name="lastname"
                                                    Text="{Binding LastName}"
                                                    BackgroundColor="Transparent"
                                                    Margin="5"
                                                    FontSize="Micro"
                                                    TextColor="Black" />
                                            </Frame>
                                        </StackLayout>
                                        <StackLayout
                                            Orientation="Vertical"
                                            HorizontalOptions="EndAndExpand">
                                            <Label
                                                Text="GENDER"
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                HasShadow="false"
                                                BorderColor="Gray"
                                                Padding="0"
                                                CornerRadius="0">
                                                <Label
                                                    Text="{Binding Gender}"
                                                    Margin="5"
                                                    TextColor="Black"
                                                    FontSize="Micro" />
                                            </Frame>
                                        </StackLayout>
                                    </StackLayout>

                                    <BoxView
                                        Color="Silver"
                                        HeightRequest="1"
                                        HorizontalOptions="FillAndExpand" />
                                    <!--// end -->
                                    <StackLayout
                                        Margin="10"
                                        Orientation="Horizontal"
                                        VerticalOptions="Center">
                                        <StackLayout
                                            Orientation="Vertical"
                                            HorizontalOptions="StartAndExpand">
                                            <Label
                                                Text="MEAL AMOUNT : "
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                IsVisible="{Binding additonalservicevisibility1}"
                                                BorderColor="Gray"
                                                HasShadow="false"
                                                Padding="0"
                                                CornerRadius="0">
                                                <Picker
                                                    x:Name="meals"
                                                    BackgroundColor="Transparent"
                                                    Title="Select Here"
                                                    SelectedIndexChanged="Handle_PickerChanged"
                                                    ItemsSource="{Binding AdditionalServiceSelect.MealValueLst}"
                                                    ItemDisplayBinding="{Binding MealServiceName}"
                                                    FontSize="Micro"
                                                    TextColor="Black">
                                                </Picker>
                                            </Frame>
                                            <Label
                                                IsVisible="{Binding additonalservicevisibility2}"
                                                Text="Meals not Available!"
                                                FontSize="Micro"
                                                TextColor="Black" />
                                        </StackLayout>

                                    </StackLayout>
                                    <StackLayout
                                        IsVisible="false"
                                        Orientation="Horizontal"
                                        HorizontalOptions="StartAndExpand">
                                        <Label
                                            x:Name="totalamountMB"
                                            Text="TOTAL AMOUNT : "
                                            TextColor="Black"
                                            FontSize="Small"
                                            FontAttributes="Bold"
                                            Margin="10,0,0,0" />
                                        <Label
                                            Text="{Binding TotalAmount}"
                                            TextColor="Black"
                                            FontSize="Small"
                                            FontAttributes="Bold"
                                            Margin="10,0,0,0" />
                                    </StackLayout>
                                    <BoxView
                                        Color="Silver"
                                        HeightRequest="1"
                                        HorizontalOptions="FillAndExpand" />
                                    <StackLayout
                                        Margin="10"
                                        Orientation="Horizontal"
                                        VerticalOptions="Center">
                                        <StackLayout
                                            Orientation="Vertical"
                                            HorizontalOptions="StartAndExpand">
                                            <Label
                                                Text="AIRLINE NAME"
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                HasShadow="false"
                                                BorderColor="Gray"
                                                CornerRadius="0"
                                                Padding="0">
                                                <Label
                                                    Text="{Binding Airname}"
                                                    BackgroundColor="Transparent"
                                                    Margin="5"
                                                    FontSize="Micro"
                                                    TextColor="Black" />
                                            </Frame>
                                        </StackLayout>
                                         <StackLayout
                                            IsVisible="true"
                                            Orientation="Vertical"
                                            HorizontalOptions="EndAndExpand">
                                            <Label
                                                Text="FREQUENT FLYER NO."
                                                TextColor="Gray"
                                                FontSize="Micro" />
                                            <Frame
                                                BackgroundColor="White"
                                                BorderColor="Gray"
                                                HasShadow="false"
                                                Padding="0"
                                                CornerRadius="0">
                                                <Label
                                                    BackgroundColor="Transparent"
                                                    FontSize="Micro"
                                                    Margin="5"
                                                    TextColor="Black" />
                                            </Frame>
                                        </StackLayout>
                                        <StackLayout
                                             VerticalOptions="Center"
                                            HorizontalOptions="EndAndExpand">
                                            <Label
                                                Text="Get Employee"
                                                IsVisible="{Binding GetPasssengerVisibility}"
                                                VerticalOptions="Center"
                                                TextColor="Green"
                                                FontAttributes="Bold"
                                                FontSize="Small"
                                                HorizontalOptions="EndAndExpand" />
                                            <Label.GestureRecognizers>
                                                <TapGestureRecognizer
                                                    Tapped="Ondetaillabeltapped"
                                                    NumberOfTapsRequired="1" />
                                            </Label.GestureRecognizers>
                                        </StackLayout>

                                    </StackLayout>
                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

                <Label
                    Margin="0,0,10,0"
                    x:Name="baggageAmount"
                    HorizontalOptions="EndAndExpand"
                    Text=" Baggage Amount : 0 "
                    TextColor="Black"
                    FontSize="Micro" />
                <Label
                    Margin="0,0,10,0"
                    x:Name="wholetotalamount"
                    HorizontalOptions="EndAndExpand"
                    Text="Total Amount : 0"
                    TextColor="Black"
                    FontSize="Micro" />
                </StackLayout>
        </ScrollView>
Viewing all 77050 articles
Browse latest View live


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