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

why is the button within the listview repeating

$
0
0

l have a list with an item source and a button.. the button is not bounded to the list data source but it repeats for as many itemsource that exists in the list. see code below and image to illustrate better

<ListView x:Name="listView"   >
    <ListView.ItemsSource>
         <x:Array Type="{x:Type local:MasterPageItem}">
            <local:MasterPageItem Title="Sign In" ![](https://us.v-cdn.net/5019960/uploads/editor/i3/yvn85vuyq4ql.png "")

                    TargetType="{x:Type local:LoginPage}" 
                    IconSource="profile.png"/> 
             <local:MasterPageItem Title="Sign In" 
                    TargetType="{x:Type local:LoginPage}" 
                    IconSource="profile.png"/>
              <local:MasterPageItem Title="Sign In" 
                    TargetType="{x:Type local:LoginPage}" 
                    IconSource="profile.png"/>   

         </x:Array>
    </ListView.ItemsSource>
    <ListView.ItemTemplate>  
        <DataTemplate>
            <ViewCell>
            <ViewCell.View>         
             <Button Text="test" BackgroundColor="Red"
                     CornerRadius="0"/>


           </ViewCell.View>
            </ViewCell>     
        </DataTemplate>
    </ListView.ItemTemplate>     
</ListView>

Viewing all articles
Browse latest Browse all 89864

Latest Images

Trending Articles



Latest Images

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