Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp on WPF Databinding to ViewModel Property (Prism)
    primarykey
    data
    text
    <p>Greetings guys, hopefully somebody has fresher eyes and can help me pinpoint the problem here, I'm trying to create a small app with prism and the MVVM pattern, everything was working nicely up to this point, my commands are firing properly with the argument, however, the TextBlock here is not binding to the CurrentUserKey property from it's viewmodel as it should.</p> <p>Anybody has any ideas? thanks in advance...</p> <p>LoginView.xaml (only relevant parts for brevity) ... </p> <pre><code>&lt;Grid DataContext="{Binding Path=., Source={StaticResource viewModel}}"&gt; &lt;Grid Margin="10"&gt; &lt;Label VerticalAlignment="Center" HorizontalAlignment="Right"&gt;Enter your Key:&lt;/Label&gt; &lt;TextBlock Name="txtUserKey" Text="{Binding Path=CurrentUserKey}" Margin="2" /&gt; &lt;Button cal:Click.Command="{Binding GenericButtonClick}" cal:Click.CommandParameter="7"&gt;7&lt;/Button&gt; &lt;Button cal:Click.Command="{Binding GenericButtonClick}" cal:Click.CommandParameter="8"&gt;8&lt;/Button&gt; &lt;Button cal:Click.Command="{Binding GenericButtonClick}" cal:Click.CommandParameter="9"&gt;9&lt;/Button&gt; ... &lt;/Grid&gt; ... </code></pre> <p>LoginViewModel.cs</p> <pre><code>public class LoginViewModel : ViewModelBase { public LoginViewModel() { GenericButtonClick = new DelegateCommand&lt;string&gt;(GenericButtonClickHandler); } private void GenericButtonClickHandler(string argument) { if (argument.Length &lt; 2) { CurrentUserKey += argument; } RaisePropertyChangedEvent("GenericButtonClick"); } public string CurrentUserKey { get; set; } private ICommand GenericButtonClick { get; set; } } </code></pre> <p>ViewModelBase.cs</p> <pre><code>public class ViewModelBase:INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChangedEvent(string Property_name) { if (Property_name == null) return; PropertyChangedEventArgs e = new PropertyChangedEventArgs(Property_name); PropertyChanged(this, e); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload