<?xml version="1.0" encoding="utf-8" ?>
<ContentPage 
    x:Class="MauiAppStock.Views.FournisseursPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:vm="clr-namespace:MauiAppStock.ViewModels">
    
    <ContentPage.BindingContext>
        <vm:FournisseursViewModel/>
    </ContentPage.BindingContext>
    
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="+" Clicked="OnAddFournisseurClicked"/>
    </ContentPage.ToolbarItems>
    
    <StackLayout Padding="10">
        <Label Text="Liste des Fournisseurs" FontSize="24" HorizontalOptions="Center"/>
        <ListView x:Name="FournisseursListView" ItemsSource="{Binding Fournisseurs}" 
                  IsPullToRefreshEnabled="True"
                  RefreshCommand="{Binding LoadFournisseursCommand}"
                  >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextCell Text="{Binding Nom}"/>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>