title: Switch with static argument (c#,WPF)
body: <p>I'm working on an application that contain 2 pages (main page, detail page)</p>
  <p>The main page contain multiple buttons , what i want to do is to make the detail page aware of what button clicked so it gives the proper details.</p>
  <p>What i did is declare a static variable and access to it from the main page</p>
  <pre><code>    private void NavigateToDetails(int ButtonNumber)
      {
          _regionManager.RequestNavigate(&quot;ContentRegion&quot;, &quot;DetailsPage&quot;);
          DetailsPageViewModel.CurrentPage = ButtonNumber;
      }
  
  - On Detail page :
  
      private static int _currentPage;
      public static int CurrentPage
      {
          get { return _currentPage; }
          set
          {
              _currentPage = value;
                  OnStaticPropertyChanged(&quot;CurrentPage&quot;);
          }
      }
  </code></pre>
  <p>if i bind this static variable to label it works but if i use it on a method it return 0 everytime , here is what i want it to do :</p>
  <pre><code>    private void ValuesRefreshed(object sender, EventArgs e)
      {
  
          switch (_currentPage)
          {
              case 1:
                  Name = ModelDb1.Name
                  break;
              case 2:
                  Name = ModelDb2.Name
                  break;
              default:
                  Name = &quot;not found&quot;
                  break;
          }
      }
  </code></pre>
  <hr />
  <h1>Solved</h1>
  <p>Update I just realized that I call the page before modifying the static so all I had to is to rewrite the NavigateToDetails to</p>
  <pre><code>DetailsPageViewModel.CurrentPage = ButtonNumber;            
  _regionManager.RequestNavigate(&quot;ContentRegion&quot;, &quot;DetailsPage&quot;);
      
  </code></pre>