title: WPF Bindings to model properties in ViewModel [MVVM]
body: <p>Im working with multiple Languages in my Application.<br>
  Im trying to do this with the MVVM Pattern, which is new to me, so
  I read Tutorials from CodeProject and Tutorialspoint. </p>
  
  <p>Heres my Project Structure: </p>
  
  <pre><code>Model
   ConverterModel.cs
   LanguageModel.cs
  ViewModel
   ConverterViewModel.cs
  View
   ConverterView.xaml
    ConverterView.xaml.cs
  MainWindow.xaml
   MainWindow.xaml.cs
  </code></pre>
  
  <p>I created a model for all the language strings I need:</p>
  
  <pre><code>internal class LanguageModel : INotifyPropertyChanged
  {
      //GUI Language
  
      private string title;
      private string inputBtn;
      private string outputBtn;
      private string convertBtn;
      ...
      public string Title
      {
          get
          {
              return title;
          }
  
          set
          {
              if(title != value)
              {
                  title = value;
                  RaisePropertyChanged("Title");
              }
  
          }
      }
  
  
      public string InputBtn
      {
          get
          {
              return inputBtn;
          }
  
          set
          {
              if (inputBtn != value)
              {
                  inputBtn = value;
                  RaisePropertyChanged("InputBtn");
              }
          }
      }
  
      public string OutputBtn
      {
          get
          {
              return outputBtn;
          }
  
          set
          {
              if (outputBtn != value)
              {
                  outputBtn = value;
                  RaisePropertyChanged("OutputBtn");
              }
          }
      }
  
      public string ConvertBtn
      {
          get
          {
              return convertBtn;
          }
  
          set
          {
              if (convertBtn != value)
              {
                  convertBtn = value;
                  RaisePropertyChanged("ConvertBtn");
              }
          }
      }
  
     ...
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      private void RaisePropertyChanged(string property)
      {
          if(PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(property));
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Then I create an instance of that model in my ViewModel and fill it with the desired Data:</p>
  
  <pre><code> internal class ConverterViewModel 
  {
      internal Settings Settings{ get; set; }
      ConverterModel Model { get; set; } //where the Data Fill Method is located 
      internal LanguageModel LanguageModel { get; set; }
      String Title {get; set;} = "Banana"; //&lt;-- this seems to work just fine
  
      internal ConverterViewModel()
      {
          Model = new ConverterModel();
          Settings = new Settings();
          if(Settings.Language == "")
          {
              Settings.Language = "English";
              //getLanguage
              Settings.Save();
          }
          this.LanguageModel = Model.SetLanguageModel(Settings.Language);
      }
  </code></pre>
  
  <p>Data Fill method in ConverterModel:</p>
  
  <pre><code>class ConverterModel
  {
              internal LanguageModel SetLanguageModel(string language)
      {
          switch (language)
          {
              case "English":
                  LanguageModel english = new LanguageModel()
                  {
                      Title = "TitleSomething",
                      InputBtn = "Inputfile",
                      OutputBtn = "Outputfile",
                      ConvertBtn = "Convert",
                  };
                  return english;
              case "German":
                  LanguageModel german = new LanguageModel()
                  {
                      //Work in Progress
                  };
                  return german;
              case "French":
                  LanguageModel french = new LanguageModel()
                  {
                      //Work in Progress
                  };
                  return french;
              case "Italian":
                  LanguageModel italian = new LanguageModel()
                  {
                   //Work in Progress
                  };
                  return italian;
              default: return null;
          }
  
      }
  }
  </code></pre>
  
  <p>I have my Bindings set like this.</p>
  
  <p>MainWindow: </p>
  
  <pre><code>&lt;Window x:Class="dta2pain.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:dta2pain"
      xmlns:view="clr-namespace:dta2pain.View"
      xmlns:viewModel="clr-namespace:dta2pain.ViewModel"
      mc:Ignorable="d"
      ResizeMode="NoResize"
      WindowStartupLocation="CenterScreen"
      Title="{Binding Title}" //&lt;-- works
      Height="657" Width="910"&gt;
  &lt;Grid&gt;
  &lt;Window.DataContext&gt;
      &lt;viewModel:ConverterViewModel/&gt;
  &lt;/Window.DataContext&gt;
      &lt;view:ConverterView x:Name="ConverterViewControl"&gt;
          &lt;view:ConverterView.DataContext&gt;
              &lt;viewModel:ConverterViewModel/&gt;
          &lt;/view:ConverterView.DataContext&gt;
      &lt;/view:ConverterView&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>ConverterView :</p>
  
  <pre><code>&lt;UserControl x:Class="dta2pain.View.ConverterView"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           xmlns:local="clr-namespace:dta2pain.View"
           xmlns:viewModel="clr-namespace:dta2pain.ViewModel"
           mc:Ignorable="d" 
           d:DesignHeight="657" d:DesignWidth="910"
           Title = "{Binding Path = Title}"&gt;
  &lt;Grid&gt;
      &lt;Menu HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="910" &gt;
  
      &lt;/Menu&gt;
      &lt;Grid Margin="0,15,0,0"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="0.5*" /&gt;
              &lt;RowDefinition Height="1*"/&gt;
              &lt;RowDefinition Height="0.75*"/&gt;
              &lt;RowDefinition Height="1.5*"/&gt;
              &lt;RowDefinition Height="0.25*"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Image x:Name="LogoImg" Grid.Row="0" Source="../Images/mammutLogoTop1280.jpg" Margin="0"/&gt;
  
          &lt;Grid Grid.Row="1" Margin="15,5,15,0"&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="1*"/&gt;
                  &lt;RowDefinition Height="1*"/&gt;
                  &lt;RowDefinition Height="1.5*"/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="765*"/&gt;
                  &lt;ColumnDefinition Width="62*"/&gt;
                  &lt;ColumnDefinition Width="47*"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;TextBox x:Name="InputTxt" Template="{StaticResource TextBoxBaseControlTemplate}" Grid.Column="0" Grid.Row="0" Margin="0,0,5,0" Height="30" FontSize="14" VerticalContentAlignment="Center" /&gt;
              &lt;Button x:Name="InputBtn" Template="{StaticResource RoundCornerBtn}" Grid.Column="1" Grid.Row="0" Margin="5,0,0,0" Height="30" FontSize="14" Background="#FF006561" Foreground="White"  Grid.ColumnSpan="2" Content="{Binding LanguageModel.InputBtn}"/&gt;
              &lt;TextBox x:Name="OutputTxt" Template="{StaticResource TextBoxBaseControlTemplate}" Grid.Column="0" Grid.Row="1" Margin="0,0,5,0" Height="30" FontSize="14" VerticalContentAlignment="Center"/&gt;
              &lt;Button x:Name="OutputBtn" Template="{StaticResource RoundCornerBtn}" Grid.Column="1" Grid.Row="1" Margin="5,0,0,0" Height="30" FontSize="14" Background="#FF006561" Foreground="White" Grid.ColumnSpan="2" Content="{Binding LanguageModel.OutputBtn}"/&gt;
              &lt;Button x:Name="ConvertBtn" Template="{StaticResource RoundCornerBtn}" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,7,0,6" FontSize="16" Background="#FF006561" Foreground="White" FontWeight="Bold" Content="{Binding LanguageModel.ConvertBtn}"/&gt;
          &lt;/Grid&gt;            
  &lt;/Grid&gt;
  </code></pre>
  
  <p>    </p>
  
  <p>I dont know whether I failed at setting my Bindings to access the Properties of the instance of LanguageModel 
  Or the RaisePropertyChanged() Method is implemented in a wrong way.
  I've tried setting my Bindings like this <code>Path= LanguageModel.Property</code> before. 
  and I've tried to put the Model Properties in an Observable List and Iterating through it, which also didnt work.</p>
  
  <p>Also, when I try to debug the programm and hover my mouse over the LangaugeModel Property the Debugger shuts down with a StackOverFlow Exception. 
  Now From the Exception I guesssed that my program gets caught in a loop somewhere, but I couldnt find where. </p>
  
  <p>I Hope this is detailed enough to understand my problem.(First Post)</p>