c# - WPF Simple dialog box without MVVM -


I have to have a simple dialog box with text fields. For now I have:

View mode:

  Public class MyViewModel {public string AA {get; Set; }}  

See:

  Public Partial Category MyView: Window {Public MyView (MyViewModel Reference) {InitializeComponent (); this. DataContext = Reference; } Public String BB {Received; Set; }} & Lt; Window ... & gt; & Lt; Grid & gt; & Lt; Label & gt; Name: & lt; / Labels & gt; & Lt; Width of text box = "110" & gt; & Lt; TextBox.Text & gt; & Lt; Binding path = "aa" /> & Lt; /TextBox.Text> & Lt; / Text box & gt; ... & lt; / Grid & gt; & Lt; / Window & gt;  

To open it and value what I call:

  MyViewModel model = new MyViewModel (); MyView Dialogs = New MyView (model); Dialog.ShowDialog ();  

Now I'm taking the text box value provided from MyViewModel AA property.

Is it possible to store the value provided in MyView BB property (and therefore delete MyViewModel)? I tried to change the XML configuration, but whatever I put in there, BB property is always empty.

The only reason is that my dialogue will do nothing more than collecting this same value and I prefer to keep it as thin as possible

  & lt; Window x: name = "root" ... & gt; & Lt; Grid & gt; & Lt; Label & gt; Name: & lt; / Labels & gt; & Lt; Textbox Width = "110" Text = "{BBinding BB, ElementName = Root} / & gt; ...    

All you need to do is.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -