- Where Developers Learn, Share, & Build Careers


With

MVVM WPF I'm not in a situation where I put the code to make sure that the test Ran across to try to follow. All lines btnReset_Click method UI so I do not know the command if they are visual models but I do not want to also back to put code in my code. I thought about the two options that I thought, but also open to other solutions.

  public class Main Window {private void btnReset_Click (object sender, RoutedEventArgs e) {DynamicStackPanel.Children.Clear (); Controls.Clear (); TxtUsername.Text = string.Empty; TxtPassword.Text = string.Empty; TxtResponse.Text = string.Empty; CbxTestEnvironment.SelectedValue = string.Empty; CbxOperation.SelectedItem = null; CbxTestEnvironment.SelectedItem = Zero; }}   

or

  public class MainViewModel: DependencyObject {public MainViewModel: DependancyObject {public MainViewModel (UtilityMain win) {win.btnReset.Click + = btnReset_Click ; } Private void btnReset_Click (object sender, RoutedEventArgs e) {DynamicStackPanel.Children.Clear (); Controls.Clear (); TxtUsername.Text = string.Empty; TxtPassword.Text = string.Empty; TxtResponse.Text = string.Empty; CbxTestEnvironment.SelectedValue = string.Empty; CbxOperation.SelectedItem = null; CbxTestEnvironment.SelectedItem = Zero; }}    

This is not really an MVVM approach, no reference to view in visual model Should not be, but this idea should represent the argument. Similarly, the scene should be as small as visible logic as possible. You should be able to achieve this difference by using a combination of data and command binding. Control the visual properties of the visual model in your view. Force visualization from visual model to invite visual arguments Works on visual model data does not control UI control UI controls are updated with visual model through data binding. The whole point is to separate your UI control from your visual argument.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -