Example #1
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     TextBoxRegex.SetValidationMode(TextBoxValidated, ValidationMode);
     TextBoxRegex.SetValidationType(TextBoxValidated, ValidationType);
     TextBoxRegex.SetRegex(TextBoxValidated, Regex);
     TextBoxValidated.TextChanged += TextBoxValidated_TextChanged;
 }
        public BillingViewModel(
            IProductRepository productRepository,
            ICustomerRepository customerRepository,
            IOrderRepository orderRepository)
        {
            this.productRepository             = productRepository;
            this.customerRepository            = customerRepository;
            this.orderRepository               = orderRepository;
            this.TextChangedCommand            = new DelegateCommand <AutoSuggestBoxTextChangedEventArgs>(HandleTextChangedEvent);
            this.CustomerTextChangedCommand    = new DelegateCommand <AutoSuggestBoxTextChangedEventArgs>(HandleCustomerTextChangedEvent);
            this.QuerySubmittedCommand         = new DelegateCommand <AutoSuggestBoxQuerySubmittedEventArgs>(HandleQuerySubmittedEvent);
            this.CustomerQuerySubmittedCommand = new DelegateCommand <AutoSuggestBoxQuerySubmittedEventArgs>(HandleCustomerQuerySubmittedEvent);
            this.CellEditEndedCommand          = new DelegateCommand <DataGridCellEditEndingEventArgs>(HandleCellEditEnded);
            this.SelectedDatesChangedCommand   = new DelegateCommand <CalendarViewSelectedDatesChangedEventArgs>(HandleSelectedDatesChanged);
            this.ProceedBillingCommand         = new DelegateCommand(HandleProceedEvent);
            this.AddCustomerCommand            = new DelegateCommand(HandleAddCustomerEvent);
            this.ResetCommand = new DelegateCommand(ResetOrderView);
            this.orderItems   = new ObservableCollection <OrderItemListView>();
            this.orderItems.CollectionChanged += OrderItems_CollectionChanged;
            this.decimalTextBox = new TextBox {
                Height = (double)App.Current.Resources["TextControlThemeMinHeight"],
                Text   = "1"
            };
            TextBoxRegex.SetValidationMode(decimalTextBox, TextBoxRegex.ValidationMode.Dynamic);
            TextBoxRegex.SetValidationType(decimalTextBox, TextBoxRegex.ValidationType.Decimal);

            this.defaultTextBox = new TextBox();
            TextBoxRegex.SetValidationMode(defaultTextBox, TextBoxRegex.ValidationMode.Dynamic);
            TextBoxRegex.SetValidationType(defaultTextBox, TextBoxRegex.ValidationType.Characters);
        }