string myFile=Path.Combine(Path.GetDirectoryName(Application.ExecutablePath),"DockPanel.config");
StreamWriter sw = new StreamWriter(myFile);
这样就能在程序运行的当前路径创建了DockPanel.config文件。