For issue 1:
I bound PaidOn with TextBox in the Remark column for testing, and the code is as follows. You could see if it suits your needs.
<DatePicker
FontSize="14"
SelectedDate="{Binding PaidOn , Converter={StaticResource converter}, BindingGroupName=Group1, UpdateSourceTrigger=PropertyChanged}"
Grid.Column="1"
Grid.Row="6" />
<TextBox
FontSize="14"
Text="{Binding PaidOn, BindingGroupName=Group1, UpdateSourceTrigger=PropertyChanged}"
Grid.Column="1"
Grid.Row="7"
Foreground="#80D8FF"
Background="Transparent" />
245104-datetimeconverters.txt
The result:
After selecting date through Datapicker: The data of the Remark row comes from the data of PaidOn in the data table(replace the original line 7 for testing).
For issue 2:
You could use Binding Validation to verify whether the input of Item's information is correct. Then trigger the Button Enable based on the validation information.
For more information, you can refer to How to: Implement Binding Validation.
Code tested with Amt
and BillNo
.
Xaml code:
245423-enable-button-by-validation.txt
SaveCommand = new RelayCommand(DoSave);
public class TextBoxNotEmptyValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
string str = value as string;
bool f = !string.IsNullOrEmpty(str);
return new ValidationResult(f, Message);
}
public String Message { get; set; }
}
public class NumericValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
decimal result = 1.0M;
bool canConvert = decimal.TryParse(value as string, out result);
return new ValidationResult(canConvert, Message);
}
public String Message { get; set; }
}
Button disable:
Button enable:
----------------------------------------------------------------------------
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.