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

Find a child of listview on button click.

$
0
0

I want to get the id from a listview which is checked on button clicked.

 <StackLayout Orientation="Horizontal" x:Name="data" IsVisible="False">

            <flv:FlowListView x:Name="ResponseList" HasUnevenRows="True" Margin="2,2" SeparatorColor="Transparent"

                      SeparatorVisibility="None">

                <flv:FlowListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ContentView Padding="8">
                                <Frame BackgroundColor="#F3F3F4" HeightRequest="50" Padding="4" Margin="0">
                                    <Grid Padding="0" RowSpacing="0">

                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="25"></RowDefinition>
                                            <RowDefinition Height="40"></RowDefinition>
                                        </Grid.RowDefinitions>

                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="40*"/>
                                            <ColumnDefinition Width="40*"/>
                                            <ColumnDefinition Width="110*"/>
                                            <ColumnDefinition Width="35*"/>
                                            <ColumnDefinition Width="35*"/>
                                        </Grid.ColumnDefinitions>

                                        <Frame x:Name="CheckFrame" BackgroundColor="#f0f0f1" Margin="-4,-4,8,0" HasShadow="False"  Grid.RowSpan="2" Grid.Column="0">
                                            <controls:Checkbox x:Name="asd" VerticalOptions="Center"  HorizontalOptions="StartAndExpand" OutlineColor="{DynamicResource PrimaryTextColor}" CheckedCommandParameter="{Binding cart_id}"  CheckedOutlineColor="{DynamicResource PrimaryTextColor}" CheckColor="{DynamicResource PrimaryColor}" Margin="-10,-16,-10,-10"/>

                                        </Frame>
                                        <Frame BackgroundColor="#f0f0f1" Margin="-10,-4,8,0" HasShadow="False"  Grid.RowSpan="2" Grid.Column="1">
                                            <Image Source="cart_minus.png" IsOpaque="True" HorizontalOptions="CenterAndExpand" Margin="-10,-16,-10,-10" VerticalOptions="CenterAndExpand"/>
                                        </Frame>

                                        <Label x:Name="lbl_name1" TextColor="Black" Margin="4,0,0,0" VerticalOptions="End" FontSize="Medium" Text="{Binding name}" Grid.Row="0" Grid.Column="2"/>
                                        <Label x:Name="entry_name1" Grid.Row="1" Margin="4,0,0,0" Grid.Column="2" HorizontalOptions="Start" HorizontalTextAlignment="Start" Text="{Binding cart_date, StringFormat='Added at {0:N}'}" />

                                        <ListView x:Name="WeightList1" Grid.RowSpan="2" Grid.Column="3" HasUnevenRows="True" HorizontalOptions="Center" VerticalOptions="Center" SeparatorColor="Transparent" SeparatorVisibility="None">
                                            <ListView.ItemsSource>
                                                <x:Array Type="{x:Type x:String}">
                                                    <x:String>250 g</x:String>
                                                    <x:String>500 g</x:String>
                                                    <x:String>750 g</x:String>
                                                    <x:String>1 Kg</x:String>
                                                </x:Array>
                                            </ListView.ItemsSource>
                                        </ListView>
                                        <Image x:Name="delete" Source="delete.png" Margin="0,-12,0,0" Grid.RowSpan="2" Grid.Column="4" HorizontalOptions="End" VerticalOptions="Center" HeightRequest="20">
                                            <Image.GestureRecognizers>
                                                <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="OnTapGestureRecognizerTapped2"
                                                                      CommandParameter="{Binding cart_id}"/>
                                            </Image.GestureRecognizers>
                                        </Image>

                                    </Grid>
                                </Frame>
                            </ContentView>
                        </ViewCell>
                    </DataTemplate>
                </flv:FlowListView.ItemTemplate>


                <!--</StackLayout>-->
            </flv:FlowListView>

        </StackLayout>
    </StackLayout>
    <StackLayout
        Orientation="Horizontal"
        RelativeLayout.WidthConstraint="{ConstraintExpression Property=Width,Type=RelativeToParent,Constant=0,Factor=1}"
         RelativeLayout.YConstraint="{ConstraintExpression Property=Height,Type=RelativeToParent,Constant=0,Factor=0.9}">

        <Button x:Name="export"  Text="EXPORT" WidthRequest="180" HeightRequest="35" BackgroundColor="Transparent" BorderRadius="10" HorizontalOptions="CenterAndExpand" BorderColor="#F6694A" TextColor="#F6694A"  FontSize="15"  BorderWidth="2"/>

        <Button x:Name="add" Text="ADD" WidthRequest="180"   TextColor="White" HeightRequest="35" BackgroundColor="#F6694A" BorderRadius="10" HorizontalOptions="CenterAndExpand" FontSize="15"  BorderWidth="2"/>


    </StackLayout>

The checkbox I have used, when I will click on Export button the I need the detail of the row from the listview, which ic checked.

Any Help.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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