XAML fin passage au code
This commit is contained in:
parent
63f4d4e3e5
commit
c22532266a
|
@ -5,8 +5,43 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ISET2018_WPF"
|
||||
mc:Ignorable="d"
|
||||
Title="Fen3" Height="450" Width="800">
|
||||
Title="Fen3" Height="450" Width="300">
|
||||
<Window.DataContext>
|
||||
<local:Personne ID="24" Pre="Simon" Nom="Blabla" />
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Name="Bibi">
|
||||
<StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
|
||||
<TextBox Width="50" Text="{Binding Path=ID}" />
|
||||
<TextBox Width="50" Text="{Binding Path=ID, Mode=OneTime}" />
|
||||
<TextBox Width="50" Text="{Binding Path=ID, Mode=OneWay}" />
|
||||
<TextBox Width="50" Text="{Binding Path=ID, Mode=OneWayToSource}" />
|
||||
<TextBox Width="50" Text="{Binding Path=ID, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
<TextBox Width="50" Text="{Binding Path=Pre, Mode=TwoWay}" />
|
||||
<TextBox Width="50" Text="{Binding Path=Nom, Mode=TwoWay}" />
|
||||
<Button Name="btnVerif" Content="Vérifier" Margin="5" Click="btnVerif_Click" />
|
||||
<Button Name="btnAssigner" Content="Assigner" Margin="5" Command="{Binding BoutonAssigner}" />
|
||||
</StackPanel>
|
||||
<StackPanel Name="BiBis" Grid.Row="1" Margin="10">
|
||||
<ListView Name="ListePersonnes" Height="100" Width="240" ItemsSource="{Binding Path=LstPers}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="120" Header="Prénom" DisplayMemberBinding="{Binding Pre}" />
|
||||
<GridViewColumn Width="120" Header="Nom" DisplayMemberBinding="{Binding Nom}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<ListBox Name="lbPersonnes" Width="150" ItemsSource="{Binding Path=LstPers}" DisplayMemberPath="Nom" Margin="5"/>
|
||||
</StackPanel>
|
||||
<StackPanel Name="ZOneEdition" Margin="5">
|
||||
<TextBox Width="120" Template="{Binding ElementName=ListePersonnes, Path=SelectedItem.ID}" />
|
||||
<TextBox Width="120" Template="{Binding ElementName=ListePersonnes, Path=SelectedItem.Pre}" />
|
||||
<TextBox Width="120" Template="{Binding ElementName=ListePersonnes, Path=SelectedItem.Nom}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -19,10 +19,16 @@ namespace ISET2018_WPF
|
|||
/// </summary>
|
||||
public partial class Fen3 : Window
|
||||
{
|
||||
Personne p;
|
||||
public Fen3()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnVerif_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public class Data : INotifyPropertyChanged
|
||||
{
|
||||
|
@ -40,9 +46,9 @@ namespace ISET2018_WPF
|
|||
private int id;
|
||||
private string nom, pre;
|
||||
|
||||
public int Id { get => id; set => id = value; }
|
||||
public string Nom { get => nom; set => nom = value; }
|
||||
public string Pre { get => pre; set => pre = value; }
|
||||
public int ID { get => id; set { id = value; onPropertyChanged("ID"); } }
|
||||
public string Nom { get => nom; set { nom = value; onPropertyChanged("Nom"); } }
|
||||
public string Pre { get => pre; set { pre = value; onPropertyChanged("Pre"); } }
|
||||
|
||||
public Personne()
|
||||
{
|
||||
|
@ -50,13 +56,32 @@ namespace ISET2018_WPF
|
|||
}
|
||||
public Personne(string nom, string pre)
|
||||
{
|
||||
Id = -1;
|
||||
ID = -1;
|
||||
Nom = nom; Pre = pre;
|
||||
}
|
||||
public Personne(int id, string nom, string pre)
|
||||
{
|
||||
Id = id;Nom = nom;Pre = pre;
|
||||
ID = id;Nom = nom;Pre = pre;
|
||||
}
|
||||
|
||||
}
|
||||
public class CMDAssigner : ICommand
|
||||
{
|
||||
public event EventHandler CanExecuteChanged;
|
||||
private Action _Action;
|
||||
public CMDAssigner(Action action_)
|
||||
{
|
||||
_Action = action_;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
if (_Action != null) _Action();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue