title: How can I set up my directory to default directory in db using OpenFileDialog in WPF?
body: <p>Here's what I have so far: </p>
  
  <pre><code>private void ChangeLotFilePath()
      {
          OpenFileDialog Dialog = new OpenFileDialog();
          Dialog.Filter = "XML files (*.xml)|*.xml";
          Dialog.ShowDialog();
  
          using (DDataContext context = new DDataContext())
          {
              SystemConfiguration config = context.SysConfig.First();
  
              if (config != null)
              {
                  Dialog.InitialDirectory = config.LotLoadingDirectory;
  
              }
          }
  
  
          if (!String.IsNullOrEmpty(Dialog.FileName))
          {
              LotFileCreationDirectory = Dialog.FileName;
              DeSerializationXML(Dialog.FileName);
          }
  
      }
  </code></pre>
  
  <p>For some reason, when I set LotFileCreationDirectory = Dialog.InitialDirectory, the directory in openfiledialog does not default to anything or I get a access denied error. </p>
  
  <p>I'm not sure what I'm doing wrong. I'm just trying to grab the directory path configured by the administrator from the database and setting that directory to default when openfiledialog opens. Then the user can select an xml file from that directory.  </p>
  
  <p>Here's my property: </p>
  
  <pre><code>private const string LOT_FILE_CREATION_DIRECTORY = "LotFileCreationDirectory";
      public string LotFileCreationDirectory
      {
          get
          {
              return LotFileCreationDirectory;
          }
          set
          {
              LotFileCreationDirectory = value;
              RaisePropertyChanged(LOT_FILE_CREATION_DIRECTORY);
          }
      }
  </code></pre>