1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
public class HeuresMOMatriJour : INotifyPropertyChanged, IExtensibleDataObject
{
private int _hprod;
public ExtensionDataObject ExtensionData { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
[DataMemberAttribute(Order = 1, IsRequired = true)]
public int HeuresProd { get { return _hprod; } set { _hprod = value; NotifyPropertyChanged("HeuresProd"); } }
}
public partial class ControleFiltreRessourcesMO : UserControl
{
public static readonly DependencyProperty HeureMoToModifyProperty = DependencyProperty.Register("HeureMoToModify", typeof(HeuresMOMatriJour), typeof(ControleHeuresMO));
public HeuresMOMatriJour HeureMoToModify
{
get { return (HeuresMOMatriJour)GetValue(HeureMoToModifyProperty); }
set { SetValue(HeureMoToModifyProperty, value); }
}
Binding bindHPROD;
public ControleFiltreRessourcesMO()
{
InitializeComponent();
bindHPROD = new Binding();
bindHPROD.Source = this.HeureMoToModify;
bindHPROD.Mode = BindingMode.TwoWay;
bindHPROD.NotifyOnSourceUpdated = true;
bindHPROD.NotifyOnTargetUpdated = true;
bindHPROD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
bindHPROD.Path = new PropertyPath("HeuresProd");
this.tbHeuresProd.SetBinding(TextBox.TextProperty, bindHPROD);
}
} |
Partager