Hi Team
I have this class name in xml, UCFinishedProduct.xml(UI), now when view source code its in c# i believe this will be my back end. Question now how will i integrate these logic together so my code works? The logic is if value for both 'topseal and bottomseal' are empty during capturing, it must trigger these together so it prompt dialog message to a user, until these two captured correctly and focus be exit after.
C#
C#
namespace Feedmill_Weighbridge.Presentation
{
///
/// Interaction logic for UCFinishedProduct.xaml
///
public partial class UCFinishedProduct : UserControl, IFinishedProductView, INotifyPropertyChanged, IDataErrorInfo
{
public FinishedProductPresenter presenter;
private string _topSeal;
private string _bottomSeal;
List objBinList;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void RaisePropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private EmptyRule _validates = new EmptyRule();
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 27, 2024, 2:07 AM EDT
Hello,
Use below,
namespace Feedmill_Weighbridge.Presentation { /// /// Interaction logic for UCFinishedProduct.xaml /// public partial class UCFinishedProduct : UserControl, IFinishedProductView, INotifyPropertyChanged, IDataErrorInfo { public FinishedProductPresenter presenter; public event PropertyChangedEventHandler PropertyChanged; private string _topSeal; public string TopSeal { get { return _topSeal; } set { _topSeal = value; OnPropertyChanged(nameof(TopSeal)); } } private string _bottomSeal; public string BottomSeal { get { return _bottomSeal; } set { _bottomSeal = value; OnPropertyChanged(nameof(BottomSeal)); } } // Implement IDataErrorInfo for validation public string Error => null; public string this[string columnName] { get { string error = null; if (columnName == nameof(TopSeal)) { if (string.IsNullOrEmpty(TopSeal)) { error = "Top Seal is required."; } } else if (columnName == nameof(BottomSeal)) { if (string.IsNullOrEmpty(BottomSeal)) { error = "Bottom Seal is required."; } } return error; } } protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }