wpfvisual-studio-2010csprojdesign-time-data

Loading design-time WPF resources in Visual Studio through .csproj


In Expression Blend 4, it's possible to load design-time resources by editing your project file. Here's an example of what that would look like:

<Page Include="Properties\DesignTimeResources.xaml"
    Condition="'$(DesignTime)'=='true'
    OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)')
    AND '$(BuildingInsideVisualStudio)'!='true'
    AND '$(BuildingInsideExpressionBlend)'!='true')">
    <Generator>MSBuild:Compile</Generator>
    <SubType>Designer</SubType>
    <ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>

Now I've been trying to get the same thing working in Visual Studio 2010 without success. Has anyone gotten design-time data to load like this in Visual Studio or is this feature only supported using Expression Blend?


Solution

  • You are looking for the use of d:DesignData and d:DataContext. Here is an example on Jag Reehal's blog using Blend and Visual Studio. And a Microsoft Walkthrough