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

when I integrate Xamarin.Firebase.Analytics , the android app crash from first time when install .

$
0
0

when I integrate Xamarin.Firebase.Analytics , the android app crash in first time when install from google play store .and further there is no abnormalities found in application and analytics working fine.whenever uninstall nuggets its install and no crashes found . Is there any bug in nuggets?
Any help will be welcome.


RefreshView problem

$
0
0

Hi.

I am using a RefreshView with a CollectionView. I don't want the drag to refresh behaviour, but I do want the spinner. For some reason this seems a bit buggy; I was able to find one permutation that is almost good enough but I must be missing something. Let me explain the problem.

I have set IsRefreshing to a binding value that gets toggled on while the view is reloading (triggered from a SearchBar), in all of the below scenarios.
What I tried:
1) Just using IsRefreshing with no command. Unfortunately the view still allows me to drag to refresh, and by doing so the spinner never finishes.
2) Setting a command, but having its CanExecute return false while IsRefreshing is false. No spinner is shown, even though IsRefreshing is set to true, in case the command is disabled. Is this intended to work this way? Shouldn't the lack of a command just disallow manual drag to refresh while still allowing the IsRefreshing spinner to show?
3) Instead of setting a command, set the IsEnabled to false while IsRefreshing is false. Same result as in #2, the spinner is never shown. I am very curious why this doesn't work, surely this is a bug? It feels like something is wrong with how the control refreshes its state.

So it seems to me there is no way to use a RefreshView just for its spinner. The reason I need this is because I have a CollectionView displaying some suggestions to the user, and the user can drag the view to refresh them. However, there is also a search bar which can filter the view, at which point I don't want drag to refresh.

I did come up with a horrible hack of a solution that works almost well enough, but not 100%.

Any help appreciated.
Thanks.

Overriding OnDisappearing

$
0
0

I have a non modal page where the user enters data. If the user clicks the software back button (popping the task) before saving his entered data I want to ask the user if they want to save the data.

I can do this by overriding OnDisappearing like so:
async protected override void OnDisappearing () { //base.OnDisappearing (); if (UnsavedData ()) { bool answer = await DisplayAlert ("Unsaved Changes", "Would you like to save your changes?", "Yes", "No"); if (answer) { PersistChanges (); } } }
The problem I am running into is that before PersistChanges is called, my code returns to previous screen.
What can I do to delay the pop until after PersistChanges executes?

Thank you.

Open Page, when clicked on element in ListView

$
0
0

Hi, I have a milestone. In my xamarin code I have some page with Listview with some events. I want to open a page with more information when clicked. What is more my page with Listview is inside tabbedPage, so when I call this page with more info about the event i want to keep the navigation from tabbed page

Click on first event -> get the page below
And same eith every event

<StackLayout Grid.Row="3"> <ListView ItemsSource="{Binding MeetingDetails}" RowHeight = "100"> <ListView.ItemTemplate > <DataTemplate> <ViewCell> <ContentView> <Grid> <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> </Grid.RowDefinitions> <StackLayout Margin="10,0" Padding="15,10,15,10" HeightRequest="100" Orientation="Vertical" HorizontalOptions="StartAndExpand" > <Label x:Name="Label_Name" Text="{Binding Name}" /> <Label> <Label.FormattedText> <FormattedString> <Span Text="{Binding DateOfStart}" FontAttributes="Bold"/> <Span Text="-"></Span> <Span Text="{Binding DateOfEnd}" FontAttributes="Bold" /> </FormattedString> </Label.FormattedText> </Label> </StackLayout> </Grid> </ContentView> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout>

List child element is not able to find by using the Appium tool

$
0
0

Hi Folks,

I have worked in the Appium testing tool (Version: 1.15.1), I am testing to Xamarin hybrid app (iOS and Android). I can select the view and also get xpath. But, In the list view, I am not able to select the child elements in the list view and also couldn’t find the xpath for child elements.

We have given automation id in source code. Even Appium inspector is not able to get elements. We used Xamarin.Form 4.3, 4.2, 3.5, and 3.0 versions.

        <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell AutomationId="MyViewCell" AutomationProperties.IsInAccessibleTree="True" >
                            <StackLayout Padding="10" AutomationProperties.IsInAccessibleTree="True" >
                                <Label x:Name="titleLbl" AutomationId="TitleLabel" Text="{Binding Text}" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" AutomationProperties.IsInAccessibleTree="True" />
                                <Label x:Name="desc" AutomationId="DescLabel" Text="{Binding Description}" d:Text="Item descripton" LineBreakMode="NoWrap" Style="{DynamicResource ListItemDetailTextStyle}" FontSize="13" AutomationProperties.IsInAccessibleTree="True" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>

Kindly give solutions for this problem.

Thanks.

Can't change color Shell bar

$
0
0

I'm working with shell template at the beginning it comes with "TabBar" and I've replaced them with "FlyoutItem" but when I did that the color of my NavBar changed to blue again, no matter how many times I change the color it remains in blue.

This works fine:
`

<Shell.Resources>
    <ResourceDictionary>
        <Color x:Key="NavigationPrimary">#F87412</Color>
        <Style x:Key="BaseStyle" TargetType="Element">
            <Setter Property="Shell.BackgroundColor" Value="{StaticResource NavigationPrimary}" />
            <Setter Property="Shell.ForegroundColor" Value="White" />
            <Setter Property="Shell.TitleColor" Value="White" />
            <Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
            <Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
            <Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
            <Setter Property="Shell.TabBarForegroundColor" Value="White"/>
            <Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
            <Setter Property="Shell.TabBarTitleColor" Value="White"/>
        </Style>
        <Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
    </ResourceDictionary>
</Shell.Resources>



<!-- Your Pages -->
<TabBar>
    <Tab Title="Browse" Icon="tab_feed.png">
        <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </Tab>
    <Tab Title="About" Icon="tab_about.png">
        <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
    </Tab>
</TabBar>

`

This change the NavBar back to blue:
`

<!-- 
    Styles and Resources 
-->
<Shell.Resources>
    <ResourceDictionary>
        <Color x:Key="NavigationPrimary">#F87412</Color>
        <Style x:Key="BaseStyle" TargetType="Element">
            <Setter Property="Shell.BackgroundColor" Value="{StaticResource NavigationPrimary}" />
            <Setter Property="Shell.ForegroundColor" Value="White" />
            <Setter Property="Shell.TitleColor" Value="White" />
            <Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
            <Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
            <Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
            <Setter Property="Shell.TabBarForegroundColor" Value="White"/>
            <Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
            <Setter Property="Shell.TabBarTitleColor" Value="White"/>
        </Style>
        <Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
    </ResourceDictionary>
</Shell.Resources>

<FlyoutItem Title="Nuevo Proyecto">
    <ShellContent Icon="nuevoProyecto.png" ContentTemplate="{DataTemplate local:ItemsPage}" />
</FlyoutItem>
<FlyoutItem Title="Proyectos guardados">
    <ShellContent Icon="proyectosGuardados.png" ContentTemplate="{DataTemplate local:AboutPage}" />
</FlyoutItem>
<FlyoutItem Title="Contáctanos">
    <ShellContent Icon="contactanos.png" ContentTemplate="{DataTemplate local:ItemsPage}" />
</FlyoutItem>
<FlyoutItem Title="Perfil" >
    <ShellContent Icon="profile.png" ContentTemplate="{DataTemplate local:ItemsPage}" />
</FlyoutItem>

`


Is this a feature, a bug or something wrong in my code?

Why does setting Application.Current.MainPage while app is in the background not work in Android?

$
0
0

When running the following statement while the application is in the background on Android, the view will not change when coming back to the app.

Application.Current.MainPage = new xxxPage();

In iOS, this will correctly set the main page while the application is away. When the user comes back, it will be on the xxxPage. However, in Android, the line of code gets run. The type of Application.Current.MainPage changes to an xxxPage. But, the view/UI itself does not change. I tried wrapping it in a Device.BeginInvokeOnMainThread; that had no effect. Any thoughts? Is this a bug in Xamarin.Forms? Is this a limitation of Android?

For reference, I am testing on a tablet on Android 8.1.0 with Xamarin.Forms 4.1.0.555618.

How to convert a URL to HTML in Xamarin?

$
0
0

Hello,

I have a requirement that is need to convert a URL string to HTML string. From the below code snippet,

strings are converted but if url has image or gif, it is not converting. Can any one please suggest?

public static string GetHTMLFromURL(string url = "https://www.google.com/")
{
string htmlstring = string.Empty;.
using (WebClient client = new WebClient())
{
htmlstring = client.DownloadString(url);
}

return htmlstring;

}

I tried the below link but no use

https://stackoverflow.com/questions/16642196/get-html-code-from-website-in-c-sharp

Don't want to use third party library.


Support to convert the HTML to PDF in Xamarin Forms

$
0
0

Support to convert the HTML to PDF in Xamarin Forms

How to convert Xamarin.Forms XAML page to PDF file?

$
0
0

In Xamarin.Forms, I want to convert my xaml page UI (sometimes my page is scrollable when having more content) into the PDF. I have tried the PDFSharp open source. But it works only on UWP and having some issues in iOS and Android.

So is there any free open source plugin available to convert XAML UI into PDF in all three platforms? If open source not available, is there any other way or work around to achieve it?

Thanks in advance.

Accessibility: reproduce a sound when an element become focused by screenreader

$
0
0

As title, what I want is to reproduce a sound when an element is accessibility focused by the screen reader. In my test app I have two Images containing a picture of a dog and a cat, and I would like to play the respective sounds when screen reader has them on focus. My initial thought was to use the "listeners" of Android and IOs (there should be something like "myElement.IsAccessibilityFocused()" for both) using dependency service but i am not sure how and if I can do that. Another idea was to create a custom class that extend AutomationProperties and add my self a component that reproduce a sound, but even for that I am not sure how to do it.
Any suggestion?
Thanks

Not being able to log in google account after archiving my app with Ad Hock

$
0
0

Hello, I am using Plugin.GoogleClient and everything works fine for me during debug or release but after archiving archiving my app with Ad Hock I am receiving the error "The Google Sign In could not complete it's process correctly". Please help if you know a solution to this problem.

Listview Selected Item Background Color

$
0
0

Is it possible to set the ListView selected item background color? Right now on IOS its gray and I want it to be transparent if possible.

Buttons not clickable after scaled StackLayout

$
0
0

Hi
I have this app that was first made for iPad that I now should release on android aswell, since there is different resolutions it didn’t fit at all(image1).

It’s just some nested StackLayouts with buttons inside that leads to new pages.
I fixed this by just scaling the main StackLayout depending on the height of the screen so now it loks like it should (image 2).

But now I have a new big problem cause it’s only what was visible in image 1 that is clickable, all buttons that wasn’t visible without scaling is clickable when scaled(image 3).

Do someone know what causing this and if there is some way to fix it without rewriting the layout completely?

Push Notification practices for login/logout?

$
0
0

I recently integrated App Center Push into my Xamarin.Forms app for iOS/Android.

In my app, users are initially presented with a login page. On login, I use AppCenter.SetUserID("username") to identify them with App Center. This lets me send push notifications via App Center by just sending "Send this to alex@email". If Alex has 5 phones and 5 tablets all logged in at the same time, this is no problem because I only need to send 1 push notification and it goes to all of them. I regularly send push notifications for my chat-like app when the app is in the background. I need users to know a new message is waiting for them.

The problem comes when a user logs out. You can't clear or change the device install ID because its set in stone on app installation. So the user logs out, but they're still getting push notifications meant for "alex@email". One theory I had was to change/scramble the username upon clicking logout like AppCenter.SetUserID("asdfasdf96fa98sfa98s76f59as8f"). Unfortunately this doesn't seem to break the "link" between the device install ID and the previous username. No matter what you try to set username to, the old install ID still remains and thus you continue receiving notifications for that user. Even if you log in as a completely different person, you keep getting the previous login's stuff.

So I guess I am confused what the point of App Center Push's "push to specific users" functionality is. It seems to me like my only option is to resort to having to catalog every single Device Install ID in a database on my server. I have to be responsible for keeping a mapping of IDs-to-usernames, and then spam them all at the same time when I need to run a push notification. So what I find myself doing is creating a SQL table like "tblMobilePush" where I have 1 row per Device Install ID, and then a field to say which username that device belongs to. When I want to send something, I have to say "grab all IDs where username = "alex@email". Then somehow I have to know to remove or expire IDs that are dead... which means I need to call a "logout" API to erase it when someone clicks "logout". But what if someone doesn't click "logout" and they just uninstall instead?

Is any of this accurate? Is there a better way to do this? Is App Center Push the service I should be using?
I appreciate any advice as I've been scratching my head about this for a while...


How to make Email activation from Register page?

$
0
0

I try to input email at Register page, and user check email and there is a link for activation and verification.

and then user can register user's email.

is it possible using .net Api?

Please help me.

Thank you.

Left margin of SwitchCell

$
0
0

SwitchCell seems to have a built in margin at left side. That makes it a bit tricky to align different views in a TableView. Is it a bug or did the XF team think it’s a feature?

Xamarin Text-to-Speech in Arabic

$
0
0

Hi,

How can I set the language of Text-to-Speech to Arabic language ar-AE?

Thanks,
Jassim

Only 1st cell in my listView works properly, every next doesnt work

$
0
0

Hi, I have problem with items inside listView, when i click the cell, only first cell in list works properly, second third and every next doesnt work, Idont know why, below is my xaml code, and phote. We can see that list has 3 cells, but only 1st works on click

 <ListView x:Name="meetingList" ItemsSource="{Binding MeetingDetails}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" RowHeight = "100">
                        <ListView.ItemTemplate >
                            <DataTemplate>
                                <ViewCell>
                                    <ContentView>
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="40"/>
                                                </Grid.RowDefinitions>
                                                <StackLayout  Margin="10,0" BackgroundColor="red" Padding="15,10,15,10" HeightRequest="100" Orientation="Vertical" HorizontalOptions="StartAndExpand" >
                                                    <Label x:Name="Label_Name" Text="{Binding Name}" />
                                                    <Label>
                                                    <Label.FormattedText>
                                                        <FormattedString>
                                                            <Span Text="{Binding DateOfStart}" FontAttributes="Bold"/>
                                                            <Span Text="-"></Span>
                                                            <Span Text="{Binding DateOfEnd}" FontAttributes="Bold" />
                                                        </FormattedString>
                                                    </Label.FormattedText>
                                                </Label>
                                                </StackLayout>
                                            </Grid>
                                        </ContentView>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>

UWP - Immediate crash in release mode

$
0
0

I have a forms solution, it runs fine in debug but crashes immediately in release mode, it doesn’t even get to my MainPage constructor:

    Unhandled exception at 0x54D62408 (Windows.UI.Xaml.dll) in SmartCart.UWP.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0D6594E8, 0x00000003).
    Unhandled exception at 0x76341104 (combase.dll) in SmartCart.UWP.exe: 0xC0000602:  A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
    STATUS_STACK_BUFFER_OVERRUN encountered
    The program '[11592] SmartCart.UWP.exe' has exited with code -1073740791 (0xc0000409).

When I build everything in release except for my UWP project the project will run.

Is this an issue with forms? Has anyone build and run UWP Forms in release mode?

Viewing all 77050 articles
Browse latest View live


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