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

How to use Socket.IO Client .NET

$
0
0

i am creating a new chat Messenger but i am not understand how to use Socket.IO Client .NET in my app plz Help


Build error when using DataTrigger inside list item template

$
0
0

I need to use DataTrigger in ListView ItemTemplate. I simplified everything till following example (trigger syntax copypasted from Xamarin samples git):

<ListView>
  <ListView.ItemTemplate>
    <DataTemplate>
      <ViewCell>
        <ViewCell.View>
          <Entry x:Name="entry" Text="" Placeholder="required field" />

          <!-- referenced below in DataTrigger-->
          <Button x:Name="button" Text="Save"
                  FontSize="Large"
                  HorizontalOptions="Center">
            <Button.Triggers>
              <DataTrigger TargetType="Button"
                            Binding="{Binding Source={x:Reference entry},
                                          Path=Text.Length}"
                            Value="0">
                <Setter Property="IsEnabled" Value="False" />
              </DataTrigger>
            </Button.Triggers>
          </Button>
        </ViewCell.View>
      </ViewCell>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

On build I'm getting error

FeedbackPage.xaml : error : Sequence contains no elements

Googling did not helped :( Can anybody explain is it possible to use triggers in data templates?

Xamarin forms Scrollview Scrolled finished/ending how to know

$
0
0

Hey.

I am trying to find a way, to know when a scrollview is not scolling anymore, so after the scoll is stopped, i can call ScrollView.ScrollToAsync, to position the element, that is closet to the center of my View content. But before i can make the last small position of my elements, i have to know that, _scrolledEventArgs.ScrollX is not changing anymore.

Hope some one can help.

how to create class like MainPage.ButtonFacebook_Clicked.xaml.cs in visual studio

$
0
0

How to create class like MainPage.ButtonFacebook_Clicked.xaml.cs in visual studio.Which item i have to choose to create such a class.Usually we have MainPage.xaml.cs which is generated automatically.Please help me. :(

which folder is images on Wp81 and UWP?

$
0
0

Xamarin documentation says that I should add images directly under the project without any sub folder if I am referring to from XF project but I saw in video on channel9, they were adding images under assets folder? Is there anyway to use subfolders for wp81 and uwp?

Xamarin Forms Map error on Andriod

$
0
0

I'm getting a Unhandled Exception when debug project.

/////////////////////////////////////////////////////////////////////////////////
Unhandled Exception:

Java.Lang.NumberFormatException: For input string: "@2131493172"
/////////////////////////////////////////////////////////////////////////////////

here the code :
LoadApplication(new App());
at MainActivity.cs

Please help me!

How to implement XAML Css

$
0
0

hello, guys, can you explain how to implement XAML style with CSS and give me any references to ebook or any git project for exercise

Push notifications

$
0
0

Hi, Anyone did push notifications in xamarin forms. I need to send push notifications based on users rights. Some notification needs to be send to specified people but some others to all people. I am using REST web service .

Sismail


How to download a file in Xamarin Forms and store it in the device storage ?

Custom GridView with Bindable DataSource and Template

$
0
0

Hello,

i made a CustomGrid with a BindableProperty ItemsSourceProperty as seen Below.

class CustomGrid : Grid { public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create( "ItemsSource", typeof(ObservableCollection<DeviceParameterItem>), typeof(CustomGrid), propertyChanged: (bindable, oldvalue, newvalue) => { newvalue = ItemsSourceProperty; });
I am able to bind the ItemsSource in my ViewModel and it's creating my Grid dynamically in respect to the DataSource.

Now, i want the Data to update without Building the whole Grid new, because i have data in the grid which changes every few milliseconds.

Can you pls give me a hint on how to do this?

Deployment Error when i using Push Notification.

$
0
0

Hi,
Am New to Xmarin forms,
Am trying to Implement Push Notification to my project, for that am using App Center and Google Firebase by watching some videos. Implemented without any Build Error. But while Deploying in debug mode am getting following Error.

**Android application is debugging.
The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).

Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.**

after spending 3 hours i came to know this is the problem because of i put thease lines in AndroidManifest.xml

**<permission android:protectionLevel="signature" android:name="${applicationId}.permission.C2D_MESSAGE"
<uses-permission android:name=""

after commenting the above line deployment working fine. but push notification not working.
pls help me

thank you

The "AdjustJavacVersionArguments" task failed unexpectedly

$
0
0

When I try build my Xamarin.Forms Android solution in Visual Studio 2017, I got error message:

everity Code Description Project File Line Suppression State
Error The "AdjustJavacVersionArguments" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at Xamarin.Android.Tasks.AdjustJavacVersionArguments.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() XamarinApp2.Android

What could be the cause of this error?

Hide and show listview items based on a string value.

$
0
0

I have a listview like the following picture. There is a more icon(in blue color) and switch on the right side of each list item.

I have a string variable called type, if "type" value is "switch", I need to hide the more icon from the list and show switch icon only and if the "type" value is "more" hide the switch from the list and show more icon only.
The more and switch are inside listview like below:

<ListView>
      <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <StackLayout>
                                        //Items like profile image name 
                                         <Image   //more icon     />
                                          <Switch/>
                                 </StackLayout>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
          </ListView>

Thanks in advance

How to submit crash report to Microsoft App Center for Xamarin.Forms?

$
0
0

Hello,

I want to submit crash report to Microsoft App Center for my project which is created in Xamarin.Forms.

Can anybody please suggest a link or steps where I can follow and integrate required steps in my project? I also want to test.

Please guide.

Logout Display alert xamarin.forms

$
0
0

I've been trying to allow a user to confirm logout by using DisplayAlert. If they click "No" it should remain in their profile page else they should be redirected back to the login page. I haven't managed to get this done, if I click Yes or No, both options remain in the profile page
Below is my code:
public async void LogoutBtn(object sender, EventArgs e)
{
var answer = await DisplayAlert("Exit", "Do you wan't to exit the App?", "Yes", "No");
if(answer.Equals("Yes"))
{
Settings.FirstName = string.Empty;
Settings.LastName = string.Empty;
Settings.Email = string.Empty;
await Navigation.PushAsync(new MainPage());
}
else
{
App.Current.MainPage = new Profile();

                }

            }

Xamarin.Forms.Maps Marker/Pin Clustering

$
0
0

Hi there,

I was wondering if anyone has come across a way to do clustering of pins/markers in a shared project?

Update language translation on the fly using TranslateExtension

$
0
0

Following this guide I'm trying to localize my app. I don't want to get system language. I have 3 resx files for the 3 languages that I want to support. I'm able to set the current culture at start and the strings are displayed correctly.

My goal is to change the language while you are using the app. TranslateExtension class is in MyApp.Resources PCL library and this is my page to select the language.

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:vm="clr-namespace:MyApp"
                 xmlns:t="clr-namespace:MyApp.Resources;assembly=MyApp.Resources"
                 x:Class="MyApp.Pages.LanguagePage"
                 BindingContext="{Binding Source={x:Static vm:App.Locator}, Path=Language}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ListView x:Name="contactsListView" Grid.Row="0" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextCell Text="{Binding Value}" Detail="{Binding Key}"  />
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <Button Grid.Row="1" Text="{t:Translate Accept}" Clicked="OkButtonClicked" Command="{Binding SaveLanguageCommand}"/>
        </Grid>
    </ContentPage>

When a item in the ListView is selected the accept button should change the text (this is what I want). How can I do that?

OnElementChanged triggered in a custom renderer for all elements under iOS

$
0
0

Hi!,
of course my first posting is a question. :)

I am developing a Xamarin Forms Application for iOS and Android. One part of it shows a list with pictures, which are downloaded from a server. In the PCL we bind a List to the ListView and use a customrenderer for the picture view. So far all was well, until the last update of our nuget packages, which also included Forms updates.
The Android App works as before, but the iOS Version shows now a different runtime behaviour.
In OnAppearing of the page we convert the received list and add the items to the bound List:
ObservableCollection _listData = new ObservableCollection();

and while adding the elements i already see a difference between Android and iOS:

Android: Alle Elements are added to the list and afterwards the OnElementChanged of the custom renderer is triggered. Additionally only the visible "Customrenderers" are called. Which results in an expected behaviour.

iOS: right after adding an Element to the list, OnElementChanged of the custom renderer is triggered. Also it is called for all elements. Additionalyl I see for the first/second none visible element e.OldElement passed as parameter, and from there on for each new element OnElementChanged triggered one more time. It seems, for me, that the list is shifting elements and triggering every time the event. This results in a lot of calls and additional all Pictures are downloaded at the same time. Funny fact: the downloads are now also finished at the same time. Because the app downloads more Pictures as needed on start up, the user has to wait some time.

Now the Question: How could I get the same behaviour in iOS like Android? Or the other way round, what causes the difference?

Thanks
Wolfgang

Android emulators wont work - incompatibility between HAXM hypervisor and VirtualBox 4.3.30+

$
0
0

Having an issue with the emulator deploying an app. I keep getting an issue that "there's an incompatibility between HAXM hypervisor and VirtualBox 4.3.30+ which doesn't allow multiple hypervisors to co-exist.". This is despite the fact I dont even have VirtualBox installed

I am running a newly purchased windows machine and never have installed virtual box.

Have attached screen shots of setup... anyone else run into this issue as I cant make sense of this at the moment.

2>Starting deploy Emulator_Nexus_5 ...
2>Starting emulator Emulator_Nexus_5 ...
2>C:\PROGRA~2\Android\ANDROI~1\tools\emulator.EXE -partition-size 512 -no-boot-anim -avd Emulator_Nexus_5 -prop monodroid.avdname=Emulator_Nexus_5
2>Hax is enabled
2>Hax ram_size 0x40000000
2>HAX is working and emulator runs in fast virt mode.
2>audio: Failed to create voice `goldfish_audio_in'
2>qemu-system-i386.exe: warning: opening audio input failed
2>emulator: Listening for console connections on port: 5554
2>Failed to sync vcpu reg
2>emulator: Serial number of this emulator (for ADB): emulator-5554
2>Failed to sync vcpu reg
2>Failed to sync vcpu regemulator: ERROR: Unfortunately, there's an incompatibility between HAXM hypervisor and VirtualBox 4.3.30+ which doesn't allow multiple hypervisors to co-exist.  It is being actively worked on; you can find out more about the issue at http://b.android.com/197915 (Android) and https://www.virtualbox.org/ticket/14294 (VirtualBox)
2>
2>Internal error: initial hax sync failed
2>Emulator Emulator_Nexus_5 cannot be started.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

getting error "System.UriFormatException:Timeout exceeded getting exception details"

Viewing all 75885 articles
Browse latest View live


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