Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8653663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:35:53+00:00 2026-06-12T14:35:53+00:00

I am developing a WPF app and I just came across Loading a Script

  • 0

I am developing a WPF app and I just came across Loading a Script File(.xml) operation where I should load it from the system, get the file from the combobox and call Load Method.

Xaml:

<ComboBox Name="ScriptCombo" SelectedIndex="0" >
         <ComboBoxItem Content="Select Aardvark Script" />
         <ComboBoxItem Content="{Binding ScriptPath}" />
</ComboBox>

<Button Content="..." Command="{Binding Path=ScriptPathCommand}" Name="ScriptFileDialog" />

ViewModel:

private string _ScriptPath;
public string ScriptPath
{
    get { return _ScriptPath; }
    set
    {
        _ScriptPath = value;
        NotifyPropertyChanged("ScriptPath");
    }
}

// Method gets called when ... Button is clicked
private void ExecuteScriptFileDialog()
{
    var dialog = new OpenFileDialog { InitialDirectory = _defaultPath };
    dialog.DefaultExt = ".xml";
    dialog.Filter = "XML Files (*.xml)|*.xml";
    dialog.ShowDialog();
    ScriptPath = dialog.FileName; //Stores the FileName in ScriptPath
}

This opens a File dialog and lets me select a .xml file. Here it doesnt show me the CurrentWorkingDirectory when Dialog opens. How can that be achieved??? Thus After Selecting when I click Open and put a breakpoint near ScriptPath statemnt, it shows the path of the file in my combobox.

Also I want to get this file and store it in a FILE type and thus call LoadFile method. I did it in C++ as follows:

File file = m_selectScript->getCurrentFile(); //m_selectScript is combobox name
if(file.exists())
{
LoadAardvarkScript(file);
}

void LoadAardvarkScript(File file)
{
}

In WPf i did like :

ScriptPath = dialog.FileName;
if (File.Exists(ScriptPath))
{
   LoadAardvarkScript(ScriptPath);
}
}

public void LoadAardvarkScript(string ScriptPath)
{
   MessageBox.Show("Start Reading File");
}

I am passing FILE as perameter in C++ code and here I am passing a string. Will it create any issue while reading the xml file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:35:54+00:00Added an answer on June 12, 2026 at 2:35 pm

    I don’t exactly understand what your problem is, but the directory that is initially shown by an OpenFileDialog is set by its InitialDirectory property and hence is what you have put into your defaultPath variable. This could for example be the value of the System.Environment.CurrentDirectory property.

    For the second part of your question, there is a File class in .Net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a WPF app using MVVM. Most of my views have only xaml
I'm developing a WPF app in which I have a ScrollViewer with grid (16
I am developing a WPF User Control for displaying portions of XML files. I'm
I'm developing a WPF with WCF app on .NET 4.0, the machine in which
I am developing a WPF app in MVVM presentation pattern. I have a grid
I am developing a WPF desktop app for a small business. It will have
I am developing an application using WPF. The app runs full screen, and I
I am developing a WPF app using MVVM and need some help. for the
I am developing a wpf app. I have a database like this. I have
I am developing a WPF app that contains a webbrowser control that loads a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.