Value of the property does not change when the textbox is cleared - c#

I have a ViewModel Called HaemogramViewModel
Here is code:
public class HaemogramViewModel : INotifyPropertyChanged
{
public HaemogramViewModel()
{
}
public Haemogram CurrentHaemogramReport
{
get
{
return MainWindowViewModel.cHaemogram;
}
set
{
MainWindowViewModel.cHaemogram = value;
OnPropertyChanged("CurrentHaemogramReport");
}
}
protected virtual void OnPropertyChanged(string PropertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(PropertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
In my MainWindowViewModel Calss:
class MainWindowViewModel : INotifyPropertyChanged
{
public MainWindowViewModel()
{
cHaemogram = new Haemogram();
}
public static Haemogram cHaemogram { get; set; }
private void SaveChanges(object obj)
{
using (Lab_Lite_Entities db = new Lab_Lite_Entities())
{
//db.Patients.Add(CurrentPatient);
if (cHaemogram != null)
{
if (cHaemogram.Haemoglobin != null)
{
db.Haemograms.Add(cHaemogram);
}
}
}
}
}
My textbox is bound to the field Haemoglobin of CurrentHaemogram Property.
When I enter some value in the textbox and then click save button then everything works fine.
Now the problem is :
When I enter some value in the textbox then I press tab and then again click on textbox and then clear the value in the textbox. Now if I click on save button then I don't get the textbox's value = null, instead I get the textbox's value = the value that I entered previously.

Try this it works
<TextBox Text="{Binding B, UpdateSourceTrigger=PropertyChanged, TargetNullValue=''}"/>
and in you view model property should be declared as below
private double? b;
public double? B
{
get
{
return b;
}
set
{
b = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("B"));
}
}
}

In your xmal you have to set the property UpdateSourceTrigger=PropertyChanged as below
<TextBox Text="{Binding Path=Property, UpdateSourceTrigger=PropertyChanged}"/>
By defalut UpdateSourceTrigger=LostFocus, that means the property bound to the textBox will get updated once you press tab or it's focus is lost. If you set to PropertyChanged it will update the property for every char change in the textBox

Related

ComboBox SelectedItem Binding

I have a ComboBox in my View:
<ComboBox Name="comboBox1" ItemsSource="{Binding MandantList}" SelectedItem="{Binding CurrentMandant, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Firma}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Here is my Model:
public class MandantListItem : INotifyPropertyChanged
{
public MandantListItem() { }
string _Firma;
bool _IsChecked;
public string Firma
{
get { return _Firma; }
set { _Firma = value; }
}
public bool IsChecked
{
get
{
return _IsChecked;
}
set
{
_IsChecked = value;
OnPropertyChanged(nameof(IsChecked));
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
And here is my ViewModel:
public class MaViewModel : INotifyPropertyChanged
{
public ObservableCollection<MandantListItem> MandantList { get { return _MandantList; } }
public ObservableCollection<MandantListItem> _MandantList = new ObservableCollection<MandantListItem>();
private MandantListItem _CurrentMandant;
public MandantListItem CurrentMandant
{
get { return _CurrentMandant; }
set
{
if (value != _CurrentMandant)
{
_CurrentMandant = value;
OnPropertyChanged("CurrentMandant");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
How to fill the ComboBox:
public zTiredV2.ViewModel.MaViewModel MAList = new zTiredV2.ViewModel.MaViewModel();
this.comboBox1.ItemsSource = MAList.MandantList;
MAList.MandantList.Add(new zTiredV2.Model.MandantListItem { Firma = "A", Homepage = "a.com", IsChecked = false });
MAList.MandantList.Add(new zTiredV2.Model.MandantListItem { Firma = "B", Homepage = "b.com", IsChecked = false });
But my item doesnt update ... tried also via IsChecked, but no success either ... when i iterate through MAList, IsChecked is always false. And how can i bind a TextBlock to the selected Firma?
Have a hard time with MVVM, but i like it.
You should set the DataContext of the ComboBox to an instance of your view model. Otherwise the bindings won't work:
this.comboBox1.DataContext = MAList;
Also note that the _MandantList backing field for your property shouldn't be public. In fact, you don't need it at all:
public ObservableCollection<MandantListItem> MandantList { get; } = new ObservableCollection<MandantListItem>();
Setting the DataContext should cause the CurrentMandant property to get set when you select an item in the ComboBox. It won't set the IsChecked property though.

Bound target not updating when button pressed to change value

I have some code which uses a form. The form is bound to my class, FormData. I have binding working well and updating my formData (local instance), but when I try to change the value of one of the variables in formData on button click/LostFocus trigger, it doesn't update.
Here's my relevant XAML:
<TextBox x:Name="friendly_name_textBox"
Style="{StaticResource TextErrorStyle}"
Text="{Binding
PrimaryUserName,
Mode=TwoWay,
ValidatesOnExceptions=True,
ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged,
NotifyOnValidationError=True}"
HorizontalAlignment="Left"
Margin="0,75,0,0"
TextWrapping="Wrap"
VerticalAlignment="Top"
Width="120"/>`
The button trigger (which does get run):
private void Button_Click(object sender, RoutedEventArgs e)
{
formData.PrimaryUserName = "TEST";
}
And my FormData code:
public string PrimaryUserName
{
get
{
return primaryUserNameValue;
}
set
{
if(primaryUserNameValue != value)
{
primaryUserNameValue = value;
}
}
}
You need to implement the INotifyPropertyChanged interface and raise the PropertyChanged event in your formData class:
public class formData : INotifyPropertyChanged
{
private string primaryUserNameValue;
public string PrimaryUserName
{
get
{
return primaryUserNameValue;
}
set
{
if (primaryUserNameValue != value)
{
primaryUserNameValue = value;
NotifyPropertyChanged();
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
Your Class needs to implement INotifyPropertyChanged, so that the target knows if the source property changes:
https://learn.microsoft.com/en-us/dotnet/framework/wpf/data/how-to-implement-property-change-notification
It's really easy, please have a look at the documentation and adjust your code accordingly. Your Property would have to look like this:
public string PrimaryUserName
{
get
{
return primaryUserNameValue;
}
set
{
if(primaryUserNameValue != value)
{
primaryUserNameValue = value;
OnPropertyChanged("PrimaryUserName");
}
}
}
But you also need the event and onPropertyChanged function to make it work.
Happy Coding!

Updating calculated total when a property on the underlying item in a list is changed - wpf

I have a ViewModel (VM is just the code behind to simplify the example) which contains (among other things) a Pallet class. On the pallet there are many boxes. In each box there are some pieces.
I have a Wpf form the lists each box on the pallet with a textbox showing how many items are in the box. Underneath this is a label showing the total count of all items on the pallet.
My question is how to get the label to update when one of the textboxes get changed. I think this will have something to do with property change and collection changed events, but I can't seem to get it to work.
I've come across answers that seem to work for adding or removing items from the collection. The problem is that I'm not ading or removing any items. I am only changing a value on an item in the collection. I know there are a lot of questions about this issue, but I haven't been able to find one that works for me.
Here is an example program:
MainWindow.xaml
<Window>
<StackPanel>
<ItemsControl ItemsSource="{Binding Pallet.BoxesOnPallet}" AlternationCount="100" Tag="{Binding .}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!-- Cast 1 -->
<TextBox Text="{Binding NumberOfPiecesinBox}" Margin="10" Padding="3"></TextBox>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<TextBlock Text="{Binding Total}" Padding="3"></TextBlock>
</StackPanel>
</Window>
MainWindow.xaml.cs
using System.ComponentModel;
namespace Keops.Mes.Casthouse.Entities.BO
{
public class Box : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Box(int num)
{
NumberOfPiecesinBox = num;
}
public int NumberOfPiecesinBox
{
get { return _numberOfPiecesinBox; }
set
{
_numberOfPiecesinBox = value;
OnPropertyChanged("NumberOfPiecesinBox");
}
}
public int _numberOfPiecesinBox;
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Pallet.cs
using System.Collections.ObjectModel;
using System.Linq;
using Keops.Mes.Casthouse.Entities.BO;
namespace WpfApplication2
{
public class Pallet
{
public Pallet()
{
BoxesOnPallet = new ObservableCollection<Box>
{
new Box(3),
new Box(8),
new Box(5),
new Box(1),
new Box(0)
};
}
public ObservableCollection<Box> BoxesOnPallet { get; set; }
public int ItemTotal
{
get { return BoxesOnPallet.Sum(x => x.NumberOfPiecesinBox); }
set { }
}
}
}
Box.cs
using System.ComponentModel;
namespace Keops.Mes.Casthouse.Entities.BO
{
public class Box : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Box(int num)
{
NumberOfPiecesinBox = num;
}
public int NumberOfPiecesinBox
{
get { return _numberOfPiecesinBox; }
set
{
_numberOfPiecesinBox = value;
OnPropertyChanged("NumberOfPiecesinBox");
}
}
public int _numberOfPiecesinBox;
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
In this example, to update the total, your Pallet class would need to "watch" for items being added and removed from BoxesOnPallet by handling its CollectionChanged. That handler should then hook / unhook the PropertyChanged event of the added / removed item. The handler for that event can update the Total property on Pallet. It's a bit complicated to get everything working together.
public class Pallet : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Pallet()
{
BoxesOnPallet = new ObservableCollection<Box>();
BoxesOnPallet.CollectionChanged += BoxesOnPallet_CollectionChanged;
BoxesOnPallet.Add(new Box(3));
BoxesOnPallet.Add(new Box(8));
BoxesOnPallet.Add(new Box(5));
BoxesOnPallet.Add(new Box(1));
BoxesOnPallet.Add(new Box(0));
}
private void BoxesOnPallet_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
foreach (var item in e.NewItems)
{
((Box)item).PropertyChanged += Box_Changed;
}
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
foreach (var item in e.OldItems)
{
((Box)item).PropertyChanged -= Box_Changed;
}
}
}
void Box_Changed(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(Box.NumberOfPiecesinBox))
{
OnPropertyChanged(nameof(BoxesOnPallet));
}
}
public ObservableCollection<Box> BoxesOnPallet { get; set; }
public int ItemTotal
{
get { return BoxesOnPallet.Sum(x => x.NumberOfPiecesinBox); }
set { }
}
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
public class Box : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Box(int num)
{
NumberOfPiecesinBox = num;
}
public int NumberOfPiecesinBox
{
get { return _numberOfPiecesinBox; }
set
{
_numberOfPiecesinBox = value;
OnPropertyChanged(nameof(NumberOfPiecesinBox));
}
}
public int _numberOfPiecesinBox;
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
First, you need to implement INotifyPropertyChanged in Pallet class so you create a way of telling the view to re-read the correct value; then, you need to monitor PropertyChanged event of every item in the collection so you could tell whether a property has changed, while keeping the monitored items list synced with the items in collection.
Pallet.cs:
public class Pallet : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Pallet()
{
BoxesOnPallet = new ObservableCollection<Box>
{
new Box(3),
new Box(8),
new Box(5),
new Box(1),
new Box(0)
};
}
private ObservableCollection<Box> _boxesOnPallet;
public ObservableCollection<Box> BoxesOnPallet
{
get { return _boxesOnPallet; }
set
{
if (_boxesOnPallet != null)
{
foreach (Box box in _boxesOnPallet)
{
if (box != null)
box.PropertyChanged -= Box_PropertyChanged;
}
_boxesOnPallet.CollectionChanged -= BoxesOnPallet_CollectionChanged;
}
_boxesOnPallet = value;
if (value != null)
{
foreach (Box box in value)
{
if (box != null)
box.PropertyChanged += Box_PropertyChanged;
}
value.CollectionChanged += BoxesOnPallet_CollectionChanged;
}
OnPropertyChanged(nameof(BoxesOnPallet));
}
}
private void BoxesOnPallet_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e?.OldItems != null)
{
foreach (Box box in e.OldItems)
{
if (box != null)
box.PropertyChanged -= Box_PropertyChanged;
}
}
if(e?.NewItems != null)
{
foreach (Box box in e.NewItems)
{
if (box != null)
box.PropertyChanged += Box_PropertyChanged;
}
}
}
private void Box_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName.Equals(nameof(Box.NumberOfPiecesinBox)))
OnPropertyChanged(nameof(ItemTotal));
}
public int ItemTotal
{
get { return BoxesOnPallet.Sum(x => x.NumberOfPiecesinBox); }
}
private void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
Also, the binding mentioned in the XAML file seems to be OneWay which means value will be fetched from the source to the view and not vice versa; instead, this should be a TwoWay binding.
MainWindow.xaml:
...
<TextBox Text="{Binding NumberOfPiecesinBox, Mode=TwoWay}" Margin="10" Padding="3"/>
...

How can i set binding to childproperty from App.xaml

I have a problem with my Binding to a ListBox Control.
Actually i have a Property in App.xaml.cs :
public partial class App : Application, INotifyPropertyChanged
{
ObservableCollection<Panier> _panier = new ObservableCollection<Panier>();
public ObservableCollection<Panier> PanierProperty
{
get { return _panier; }
set
{
if (this._panier != value)
{
this._panier = value;
NotifyPropertyChanged("PanierProperty");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(String property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
this property have a child properties in the "Panier class" here:
public class Panier : INotifyPropertyChanged
{
private string _nom;
private string _category;
private int _prix;
public string Nom
{
get { return _nom; }
set
{
if (this._nom != value)
{
this._nom = value;
NotifyPropertyChanged("Nom");
}
}
}
public string Category
{
get { return _category; }
set
{
if (this._category != value)
{
this._category = value;
NotifyPropertyChanged("Category");
}
}
}
public int Prix
{
get { return _prix; }
set
{
if (this._prix != value)
{
this._prix = value;
NotifyPropertyChanged("Prix");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(String property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
and in my MainWindow.xaml page i have my ListBox bound to PanierProperty(parent property) :
<telerik:RadListBox x:Name="PanierLB" Grid.Row="1" Height="200" Width="350" Margin="0 300 0 0"
ItemsSource="{Binding PanierProperty, Source={x:Static Application.Current}}"
DisplayMemberPath="{Binding Path=PanierProperty.Nom, Source={x:Static Application.Current}}">
</telerik:RadListBox>
my problem is that PanierProperty is bound to my Listbox i see items in the listbox like Design.Panier
Design.Panier
Design.Panier
etc...
I dont know how to get the PanierProperty.Nom(Nom is the child property) to show on the ListBox.
Someone can help please.
In DisplayMemberPath use the name of property you want to show only:
<telerik:RadListBox
...
DisplayMemberPath="Nom"

WPF lost Databinding

I'm new to WPF and its Databinding, but I stumbled upon a strange behaviour I could not resolve for myself.
In a Dialog I've got a Listbox with Users and a TextBox for a username. Both are bound to a UserLogonLogic-which publishes among others a CurrentUser property.
I want the TextBox to update its text when I click on a name in the ListBox. I also want the SelectedItem in the ListBox to be updated when I enter a username directly into the TextBox. Partial names in the TextBox will be resolved to the first matching value in the listbox or null if there is none.
At first the TextBox gets updated every time I click into the ListBox. Debug shows me that every time the PropertyChangeEvent for CurrentUser is fired the method txtName_TextChanged method is called. Only after I have typed something into the textbox the DataBinding of the TextBox seems to be lost. There will be no further updates of the TextBox when I click into the ListBox. Debug now shows me that the method txtName_TextChanged is no longer being called after the CurrentUser PropertyChangeEvent is fired.
Does anybody have an idea where I could have gone wrong?
Thanks a lot
RĂ¼
UserLogon.xaml:
<ListBox Grid.Column="0" Grid.Row="1" Grid.RowSpan="4" MinWidth="100" Margin="5" Name="lstUser" MouseUp="lstUser_MouseUp"
ItemsSource="{Binding Path=Users}" SelectedItem="{Binding Path=CurrentUser, Mode=TwoWay}"/>
<TextBox Grid.Column="1" Grid.Row="1" Margin="3" Name="txtName" TextChanged="txtName_TextChanged"
Text="{Binding Path=CurrentUser, Mode=OneWay}" />
UserLogon.xaml.cs:
public UserLogon()
{
InitializeComponent();
_logic = new UserLogonLogic();
TopLevelContainer.DataContext = _logic;
}
private int _internalChange = 0;
private void txtName_TextChanged(object sender, TextChangedEventArgs e)
{
if (_internalChange > 0)
{
return;
}
_internalChange++;
string oldName = txtName.Text;
User user = _logic.SelectByPartialUserName(oldName);
string newName = (user == null) ? "" : user.Name;
if (oldName != newName)
{
txtName.Text = (newName == "") ? oldName : newName;
txtName.Select(oldName.Length, newName.Length);
}
_internalChange--;
}
UserLogon.Logic.cs:
public class UserLogonLogic : INotifyPropertyChanged
{
private User _currentUser;
public User CurrentUser
{
get { return _currentUser; }
set
{
if (value != CurrentUser)
{
_currentUser = value;
OnPropertyChanged("CurrentUser");
}
}
private IEnumerable<User> _users;
public IEnumerable<User> Users
{
get
{
if (_users == null)
{
List<User> _users = Database.GetAllUsers();
}
return _users;
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string prop)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
}
public User SelectByPartialUserName(string value)
{
if (value != "")
{
IEnumerable<User> allUser = GetAllUserByName(value);
if (allUser.Count() > 0)
{
CurrentUser = allUser.First();
}
else
{
CurrentUser = null;
}
}
else
{
CurrentUser = null;
}
return CurrentUser;
}
private IEnumerable<User> GetAllUserByName(string name)
{
return from user in Users
where user.Name.ToLower().StartsWith(name.ToLower())
select user;
}
}
This is a job for a good view model. Define two properties on your view model:
SelectedUser : User
UserEntry : string
Bind the ListBox's SelectedItem to the SelectedUser property, and the TextBox's Text property to the UserEntry property. Then, in your view model you can do the work to keep them in sync:
- if SelectedUser changes, set UserEntry to that user's Name
- if UserEntry changes, do an intelligent search through all users and set SelectedUser to either null if no match was found, or the first matching User
Here is a complete and working sample. I wish I could easily attach a zip file right about now.
First, ViewModel.cs:
public abstract class ViewModel : INotifyPropertyChanged
{
private readonly Dispatcher _dispatcher;
protected ViewModel()
{
if (Application.Current != null)
{
_dispatcher = Application.Current.Dispatcher;
}
else
{
_dispatcher = Dispatcher.CurrentDispatcher;
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected Dispatcher Dispatcher
{
get { return _dispatcher; }
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, e);
}
}
protected void OnPropertyChanged(string propertyName)
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
}
User.cs:
public class User : ViewModel
{
private readonly string _name;
public User(string name)
{
_name = name;
}
public string Name
{
get { return _name; }
}
}
LogonViewModel.cs:
public class LogonViewModel : ViewModel
{
private readonly ICollection<User> _users;
private User _selectedUser;
private string _userEntry;
public LogonViewModel()
{
_users = new List<User>();
//fake data
_users.Add(new User("Kent"));
_users.Add(new User("Tempany"));
}
public ICollection<User> Users
{
get { return _users; }
}
public User SelectedUser
{
get { return _selectedUser; }
set
{
if (_selectedUser != value)
{
_selectedUser = value;
OnPropertyChanged("SelectedUser");
UserEntry = value == null ? null : value.Name;
}
}
}
public string UserEntry
{
get { return _userEntry; }
set
{
if (_userEntry != value)
{
_userEntry = value;
OnPropertyChanged("UserEntry");
DoSearch();
}
}
}
private void DoSearch()
{
//do whatever fuzzy logic you want here - I'm just doing a simple match
SelectedUser = Users.FirstOrDefault(user => user.Name.StartsWith(UserEntry, StringComparison.OrdinalIgnoreCase));
}
}
UserLogon.xaml:
<UserControl x:Class="WpfApplication1.UserLogon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<StackPanel>
<ListBox ItemsSource="{Binding Users}" SelectedItem="{Binding SelectedUser}" DisplayMemberPath="Name"/>
<TextBox Text="{Binding UserEntry, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</UserControl>
UserLogon.xaml.cs:
public partial class UserLogon : UserControl
{
public UserLogon()
{
InitializeComponent();
//would normally map view model to view with a DataTemplate, not manually like this
DataContext = new LogonViewModel();
}
}
shouldn't your textbox have twoway-binding?

Categories