开发者

WPF C# Create VS-Like Projects

开发者 https://www.devze.com 2023-02-04 11:48 出处:网络
Edit: Let me rephrase my question to make it more clear. Sorry about that. I am looking to create a project based application. For开发者_StackOverflow中文版 example, the project file could be called

Edit:

Let me rephrase my question to make it more clear. Sorry about that.

I am looking to create a project based application. For开发者_StackOverflow中文版 example, the project file could be called .proj but within that there are files associated to that project similiar to how VS does it (and they just open in a tabcontrol).

So when a user selects file -> open -> project and selects a .proj file all associated files with that project will open.

Hopefully that explains it a little better. Many thanks!


Just open a project file of Visual Studio in a notepad. It is an ordinary xml file with elements PropertyGroup and ItemGroup.

References for files look in the following way:

<ApplicationDefinition Include="App.xaml">
  <Generator>MSBuild:Compile</Generator>
  <SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="App.xaml.cs">
  <DependentUpon>App.xaml</DependentUpon>
  <SubType>Code</SubType>
</Compile>

You can parse this xml, create a hierarchical collection(using an information about folders and attributes DependentUpon) and bind it with a TreeView.

Open tabs are stored in the file with an extension 'suo', but you can save them in a xml format too. After you have open a project, you should find open files in the actual files and add them to the TabControl.


You should do that like PRISM does; create a panel of any type ans stick in it the TabControl empty. Every time you select a new project you simply Clear() the number of tabs in the control. WHen you add a new file, you will do that by creating a new TabItem. The file will be displayed, of course, inside the TabItem. Is this what you mean?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号