code cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ namespace MVPLearning.BaseLibrary
|
|||||||
}
|
}
|
||||||
public void Bind(object datasource, string dataproperty)
|
public void Bind(object datasource, string dataproperty)
|
||||||
{
|
{
|
||||||
var oldBinding = this.DataBindings[nameof(BoundValue)];
|
var oldBinding = DataBindings[nameof(BoundValue)];
|
||||||
if (oldBinding != null) { DataBindings.Remove(oldBinding); }
|
if (oldBinding != null) { DataBindings.Remove(oldBinding); }
|
||||||
|
|
||||||
var newBinding = new Binding(nameof(BoundValue), datasource, dataproperty, true);
|
var newBinding = new Binding(nameof(BoundValue), datasource, dataproperty, true);
|
||||||
@@ -50,23 +50,11 @@ namespace MVPLearning.BaseLibrary
|
|||||||
}
|
}
|
||||||
protected override void OnValueChanged(EventArgs eventargs)
|
protected override void OnValueChanged(EventArgs eventargs)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine("OnValueChanged");
|
|
||||||
base.OnValueChanged(eventargs);
|
base.OnValueChanged(eventargs);
|
||||||
BoundValue = Value;
|
BoundValue = Value;
|
||||||
Format = DateTimePickerFormat.Custom;
|
Format = DateTimePickerFormat.Custom;
|
||||||
CustomFormat = Checked ? "MM/dd/yyyy" : " ";
|
CustomFormat = Checked ? "MM/dd/yyyy" : " ";
|
||||||
}
|
}
|
||||||
protected override void OnValidated(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnValidated(e);
|
|
||||||
}
|
|
||||||
protected override void OnValidating(CancelEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnValidating(e);
|
|
||||||
System.Diagnostics.Debug.WriteLine("OnValidating");
|
|
||||||
System.Diagnostics.Debug.WriteLine($"Value: {Value}");
|
|
||||||
System.Diagnostics.Debug.WriteLine($"BoundValue: {BoundValue}");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user