Search code examples
c#wpftabcontrolprojects

WPF C# Create VS-Like Projects


Edit:

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

I am looking to create a project based application. For 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!


Solution

  • 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.