Gestion repa Ok

This commit is contained in:
adri
2019-01-24 22:24:05 +01:00
parent 9e06f31677
commit ceffc1446e
107 changed files with 5340 additions and 621 deletions

View File

@@ -19,15 +19,39 @@ namespace ProjetTheAlone.UserControlDIY
/// <summary>
/// Interaction logic for Plat.xaml
/// </summary>
public partial class Plat : UserControl
{
public C_T_plat PlatV { get { return this.DataContext as C_T_plat; } }
public C_T_plat PlatV
{
get { return (C_T_plat)GetValue(PlatVProperty); }
set { SetValue(PlatVProperty, value); }
}
// Using a DependencyProperty as the backing store for Property1.
// This enables animation, styling, binding, etc...
public static readonly DependencyProperty PlatVProperty
= DependencyProperty.Register(
"PlatV",
typeof(C_T_plat),
typeof(Plat),
null
);
//public C_T_plat PlatV { get { return this.DataContext as C_T_plat; } }
public Plat()
{
InitializeComponent();
this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext);
GridPrinc.DataContext = this ;
}
public void updateDataContext(object o, DependencyPropertyChangedEventArgs e)
{
GridPrinc.DataContext = this;
var a = this.DataContext;
//GridPrinc.DataContext = this.DataContext;
}
}
}

View File

@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ProjetTheAlone.UserControlDIY"
xmlns:parent="clr-namespace:ProjetTheAlone.View"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
@@ -21,10 +22,10 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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>
<TextBox Text="{Binding Quand}" />
<local:Plat x:Name="Plat1XML" Grid.Row="1" PlatV="{Binding Plat1}"></local:Plat>
<local:Plat x:Name="Plat2XML" Grid.Row="2" PlatV="{Binding Plat2}"></local:Plat>
<local:Plat x:Name="Plat3XML" Grid.Row="3" PlatV="{Binding Plat3}"></local:Plat>
</Grid>
</UserControl>

View File

@@ -25,29 +25,19 @@ namespace ProjetTheAlone.UserControlDIY
public partial class Repa : UserControl
{
public RepaModel RM
{
get
{
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;
var a = this.DataContext;
GridPrinc.DataContext = ((RepaModel) this.DataContext);
/*Plat1XML.DataContext = ((RepaModel)this.DataContext).Plat1;
Plat2XML.DataContext = ((RepaModel)this.DataContext).Plat2;
Plat3XML.DataContext = ((RepaModel)this.DataContext).Plat3;*/
}
}
}