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

How delete past events of a page when leaving it with PopAsync ?

$
0
0

Hi everybody,
I call MyPage with Navigation.PushAsync() from the MainPage. I have next code in MyPage's constructor:

    public MyPage(IAdapter adapterin, IDevice devicein, string ChannelName)
    {
        InitializeComponent();
        adapter = adapterin;
        device = devicein;
        LabelChannelName.Text = ChannelName;

        adapter.DeviceConnectionLost += (s, e) =>
        {
            Debug.WriteLine($"LOST CONNECTION: {e.Device.Name}");
            adapter.DeviceConnectionLost -= null;
            Device.BeginInvokeOnMainThread(() =>
            {
                this.Navigation.PopAsync();
            });
            Debug.WriteLine($"LOST CONNECTION.");
        };
    }

When adapter.DeviceConnectionLost happens (for instance when I shut dowm my ble peripheral) MyPage closes correctly.
The second time I open MyPage if DeviceConnectionLost event happens then I get an Unhandled Exception, cause I guess PopAsync is reached twice. It seems that second PopAsync() generates the exception.

I have checked that if MyPage is loaded three times for example, ConnectionLost event will be executed three times, as I can see "LOST CONNECTION." text in my debug output window.

Is there any way to erase past events of MyPage after doing PopAsync ? How could I resolve this issue ?

Thanks in advance and best regards,
Asier.


What is the best approach to display to the user actions that he can do for the ListView items?

$
0
0

Hi guys, I'm implementing a ListView in Xamarin.Forms , I just implemented behaviors for when the items are tapped following this tutorial: https://blog.xamarin.com/turn-events-into-commands-behaviors/ but I also want that the user can do another actions for each item on the listview besides tapping. I drawed below how I imagined this could be done, an Image that when I click it pops a MenuList ,how can I implement this on MVVM?

Are there any Good Examples of a list view with as Sublist using data from web API?

$
0
0

Are there any Good Examples of a list view with as Sub-list using data from web API?

I all,

Would anyone know if there is an example of how one would created a sub-list with in a list view
using data returned from a web Api.

I have seen some example videos but the data is typed it.. they don't show how one would do this with database data
as well as how you would relate the data of the parent list to the child..

Most of the examples I have seen have been users hard coding data.

THanks for any help in advance.

Map.IsShowingUser="True" crashes on Android 7 with Xamarin.Forms.Maps released on 1/3/2019

$
0
0

Even though updated Xamarin.Forms.Maps to the newest version(3.4.0.1009999) and provided the following permissions in AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

The app still crashes when set IsShowingUser="True" on my Samsung Galaxy Note 5

     <maps:Map x:Name="map" HeightRequest="400" HorizontalOptions="FillAndExpand" IsShowingUser="True" />

If remove IsShowingUser="False". The map can be shown

Any solution?

MasterDetailPage does not show Master

$
0
0

I create a new application with a xaml form:

<?xml version="1.0" encoding="utf-8" ?>

<MasterDetailPage.Master>
    <ContentPage Title="Menu">
        <StackLayout>
            <Label Text="Menu"></Label>
        </StackLayout>
    </ContentPage>
</MasterDetailPage.Master>

<MasterDetailPage.Detail>
    <ContentPage>
        <StackLayout>
            <Label Text="Detail"></Label>
        </StackLayout>
    </ContentPage>
</MasterDetailPage.Detail>

When i run show only de Detail.

Background Color Transparent is not working in GroupHeaderTemplate of Listview in Xamarin Forms iOS

$
0
0

I have set background image for whole application,
In Listview, GroupHeaderTemplate Background color set 'Transparent', but it displays white only.
In Android it's working properly. Anyone knows the solution ?

InitializeComponent does not exist in the current context error

$
0
0

Hi,

The error CS0103 (The name 'InitializeComponent' does not exist in the current context) has started appearing after doing a build of our Xamarin Forms solution. The build, however, appears to have succeeded in spite of this error message?

This started happening after adding the first XAML ContentPage to the PCL project. If I remove the XAML ContentPage then the error disappears.

I've tried installing the latest Alpha channel update on both my Windows (Visual Studio) machine and my Mac build host but it hasn't made any difference.

Please advise ASAP as we would like to use XAML for our ContentPages but may have to revert to using C# code to build the UI if the XAML approach is not viable.

Regards,
Andy

63+9


93+4

98+2

81+3

86+3

28+63

36+9

82+3


92+6

49+3

96+3

73+9

94+3

Viewing all 91519 articles
Browse latest View live


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