Gros UC avec 3 petit UC Ok (3xPlat=>Repa)
This commit is contained in:
@@ -28,6 +28,5 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="FoodDesc" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="{Binding PlatV.P_nom}" />
|
||||
<Image x:Name="FoodPic" Source="{Binding PlatV.P_img, Converter={StaticResource imgConverter}}" Grid.Column="1" Stretch="Uniform"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -21,14 +21,10 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" Grid.ColumnSpan="2"/>
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="{Binding ListPlat[0].P_Nom}" />
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" />
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" />
|
||||
<TextBlock Text="{Binding Quand}" />
|
||||
<local:Plat x:Name="Plat1XML" Grid.Row="1"></local:Plat>
|
||||
<local:Plat x:Name="Plat2XML" Grid.Row="2"></local:Plat>
|
||||
<local:Plat x:Name="Plat3XML" Grid.Row="3"></local:Plat>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using ProjetTheAlone.Classes;
|
||||
using ProjetTheAlone.Model;
|
||||
using ProjetTheAlone.ViewModel;
|
||||
|
||||
namespace ProjetTheAlone.UserControlDIY
|
||||
{
|
||||
@@ -24,17 +25,29 @@ namespace ProjetTheAlone.UserControlDIY
|
||||
public partial class Repa : UserControl
|
||||
{
|
||||
|
||||
public ObservableCollection<C_T_plat> ListPlat
|
||||
public RepaModel RM
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.DataContext as ObservableCollection<C_T_plat>;
|
||||
return this.DataContext as RepaModel;
|
||||
}
|
||||
}
|
||||
|
||||
public C_T_plat Plat1 { get => ((RM==null)?new C_T_plat():RM.Plat1 ?? new C_T_plat()); }
|
||||
public C_T_plat Plat2 { get => ((RM == null) ? new C_T_plat() : RM.Plat2 ?? new C_T_plat()); }
|
||||
public C_T_plat Plat3 { get => ((RM == null) ? new C_T_plat() : RM.Plat3 ?? new C_T_plat()); }
|
||||
public Repa()
|
||||
{
|
||||
InitializeComponent();
|
||||
GridPrinc.DataContext = RM;
|
||||
Plat1XML.DataContext = Plat1;
|
||||
this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext);
|
||||
}
|
||||
public void updateDataContext(object o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
GridPrinc.DataContext = RM;
|
||||
Plat1XML.DataContext = Plat1;
|
||||
Plat2XML.DataContext = Plat2;
|
||||
Plat3XML.DataContext = Plat3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user