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

Issue while opening child page of listview in iOS

$
0
0

When i select item from Listview to open child page, nothing is happens in IPhone. everything work proper in android device.
No Exception or error log recorded by adding console logs verified that child page code is executing properly but child page UI is not displayed, instead listview display stays as it is.
please note that this issue occurs randomly in iOS.

please check below snippet code.

XAML Page

<ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <Grid Padding="8, 10 ,8, 5" BackgroundColor="#FFFFFF" HeightRequest="45" Margin="80, 0, 80, 0">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="40" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="50" />
                                    </Grid.ColumnDefinitions>
                                    <RelativeLayout Grid.Row="0" Grid.Column="0" HeightRequest="40" WidthRequest="40">
                                        <AbsoluteLayout HeightRequest="40" WidthRequest="40">
                                            <Frame CornerRadius="{OnPlatform Android='40', iOS='20'}" BackgroundColor="#A9A9A9" HasShadow="False" OutlineColor="Transparent" BorderColor="Transparent" HeightRequest="40" WidthRequest="40" Padding="0" Margin="0" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All">
                                                <Frame CornerRadius="{OnPlatform Android='40', iOS='20'}" BackgroundColor="#A9A9A9" HasShadow="False" OutlineColor="Transparent" BorderColor="Transparent" HeightRequest="40" WidthRequest="40" Padding="0" Margin="0">
                                                    <Image Source="Profile.png" Aspect="Fill" VerticalOptions="Center" HorizontalOptions="Center" BackgroundColor="Transparent" HeightRequest="40" WidthRequest="40" Margin="-1, -1, -1, -1"></Image>
                                                </Frame>
                                            </Frame>
                                        </AbsoluteLayout>
                                        <AbsoluteLayout HeightRequest="39" WidthRequest="39">
                                            <Label Text="&#xf111;" FontSize="10" TextColor="{Binding IsOnline}" 
                                            AbsoluteLayout.LayoutFlags="All"
                                            AbsoluteLayout.LayoutBounds="1, 1, 10, 10"
                                            VerticalOptions="End" HorizontalOptions="End" >
                                                <Label.FontFamily>
                                                    <OnPlatform x:TypeArguments="x:String"
                                                    Android="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free Solid" 
                                                    iOS="FontAwesome5FreeSolid" />
                                                </Label.FontFamily>
                                            </Label>
                                        </AbsoluteLayout>
                                    </RelativeLayout>
                                    <StackLayout Grid.Row="0" Grid.Column="1" VerticalOptions="CenterAndExpand" HeightRequest="30" Padding="2, 0, 0, 5">
                                        <Label x:Name="UserName" Text="{Binding UserName}" FontSize="14" x:Uid="{Binding RoomName}" HorizontalOptions="Start" FontAttributes="Bold" TextColor="#000000" LineHeight="0" MaxLines="1" Margin="{OnPlatform Android='0, -3, 0, 0', iOS='0, -3, 0, 0'}" LineBreakMode="TailTruncation" HeightRequest="18" />
                                        <Label Text="{Binding RequestStatus}" FontSize="12" HorizontalOptions="Start"  VerticalOptions="Start" TextColor="{StaticResource lightGray}" LineHeight="0" MaxLines="1" Margin="{OnPlatform Android='0, -5, 0, 0', iOS='0, -5, 0, 0'}" LineBreakMode="TailTruncation" HeightRequest="18" />
                                    </StackLayout>
                                    <StackLayout Grid.Row="0" Grid.Column="2" VerticalOptions="Start" HorizontalOptions="End">
                                        <Label FontSize="10" HorizontalOptions="End" TextColor="{Binding IsOnline}" Text="{Binding MessageTime}" LineHeight="1" Margin="{OnPlatform Android='0, 2, 0, 0', iOS='0, 0, 0, 0'}" />
                                        <Grid Padding="0" Margin="0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="30" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50" />
                                            </Grid.ColumnDefinitions>
                                            <Label Grid.Row="0" Grid.Column="0" Text="&#xf27a;" IsVisible="{Binding IsAcceptDisplay}" FontSize="14"
                                                    TextColor="#2FB26C" HeightRequest="30" VerticalOptions="Center" WidthRequest="30" HorizontalOptions="End" HorizontalTextAlignment="End">
                                                <Label.FontFamily>
                                                    <OnPlatform x:TypeArguments="x:String"
                                                    Android="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free Solid" 
                                                    iOS="FontAwesome5FreeSolid" />
                                                </Label.FontFamily>
                                            </Label>
                                            <StackLayout Grid.Row="0" Grid.Column="0" IsVisible="{Binding IsPendingMessageCount}" HorizontalOptions="End" Margin="14, 0, 0, 0">
                                                <Frame VerticalOptions="Center" HorizontalOptions="End" WidthRequest="16" MinimumWidthRequest="16" HeightRequest="{OnPlatform Android='16', iOS='15'}" 
                                                       OutlineColor="#2FB26C" BackgroundColor="#2FB26C" CornerRadius="{OnPlatform Android='20', iOS='8'}" 
                                                       Margin="0, 0, 0, 0" Padding="{OnPlatform Android='0', iOS='0, 1, 0, 0'}" HasShadow="False">
                                                    <Label Text="{Binding PendingMessageCount}" FontSize="{OnPlatform Android='8', iOS='7'}" FontAttributes="Bold" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center"
                                                    TextColor="#FFFFFF" HorizontalOptions="Center" HorizontalTextAlignment="Center" HeightRequest="16" LineHeight="0.8"></Label>
                                                </Frame>
                                            </StackLayout>
                                        </Grid>
                                    </StackLayout>
                                </Grid>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                    <ListView.Footer>
                        <StackLayout Orientation="Horizontal"></StackLayout>
                    </ListView.Footer>
                </ListView>
            </StackLayout>
        </AbsoluteLayout>
    </StackLayout>

XAML.CS file

async void OnItemSelected(object sender, SelectedItemChangedEventArgs args)
    {
        try
        {
             var item = args.SelectedItem as User;

            if (item == null)
                return;

            App.chatBoxPage = null;
            App.chatBoxPage = new ChatBoxPage(new ChatViewModel(item));
            await Navigation.PushAsync(App.chatBoxPage);
            ChatList.SelectedItem = null;

        }
        catch (Exception e)
        {
            await DisplayAlert("Live Chat", "On Clicked  : " + e.ToString(), "OK");
        }
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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