Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

ObjectPresenter - How to Generate an Object's Testing GUI from a Given Object

, 5 Jan 2012
In this article, I explain step by step, how we can create a WPF custom control that gets an object and, generates a GUI that enables editing that object's properties and invoking that object's methods.
objectpresentation_demo.zip
ObjectPresentation_Demo
Client
ObjectPresentation.dll
ObjectPresentation.Examples.Client.exe
ObjectPresentation.Examples.Client.pdb
ObjectPresentation.Examples.Contracts.dll
ObjectPresentation.Examples.Contracts.pdb
ObjectPresentation.pdb
Server
ObjectPresentation.Examples.Contracts.dll
ObjectPresentation.Examples.Contracts.pdb
ObjectPresentation.Examples.Server.exe
ObjectPresentation.Examples.Server.pdb
ObjectPresentation.Examples.Service.dll
ObjectPresentation.Examples.Service.pdb
WcfLogPrints.dll
objectpresentation_src.zip
ObjectPresentation_src
ObjectPresentation
bin
Debug
Release
obj
Debug
Properties
Settings.settings
Styles
Themes
ObjectPresentation.Examples.Client
bin
Debug
Release
obj
x86
Debug
Properties
Settings.settings
ObjectPresentation.Examples.Contracts
bin
Debug
Release
obj
Debug
Properties
ObjectPresentation.Examples.Server
bin
Debug
Release
obj
x86
Debug
Properties
ObjectPresentation.Examples.Service
bin
Debug
obj
Debug
Properties
WcfLogPrints.dll
ObjectPresentation.suo
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{8E737580-902D-424E-BB00-CD510701EBE1}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ObjectPresentation.Examples.Client</RootNamespace>
    <AssemblyName>ObjectPresentation.Examples.Client</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.ServiceModel" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Compile Include="ColorPicker.xaml.cs">
      <DependentUpon>ColorPicker.xaml</DependentUpon>
    </Compile>
    <Compile Include="InterfacePresenterExample.xaml.cs">
      <DependentUpon>InterfacePresenterExample.xaml</DependentUpon>
    </Compile>
    <Compile Include="MethodPresenterExample.xaml.cs">
      <DependentUpon>MethodPresenterExample.xaml</DependentUpon>
    </Compile>
    <Compile Include="MyCircle.cs" />
    <Compile Include="MyRectangle.cs" />
    <Compile Include="MyShape.cs" />
    <Compile Include="ObjectPresenterExample.xaml.cs">
      <DependentUpon>ObjectPresenterExample.xaml</DependentUpon>
    </Compile>
    <Compile Include="ValuePresenterExample.xaml.cs">
      <DependentUpon>ValuePresenterExample.xaml</DependentUpon>
    </Compile>
    <Page Include="ColorPicker.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="InterfacePresenterExample.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="MainWindow.xaml.cs">
      <DependentUpon>MainWindow.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Page Include="MethodPresenterExample.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="ObjectPresenterExample.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="ValuePresenterExample.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="App.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <AppDesigner Include="Properties\" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ObjectPresentation.Examples.Contracts\ObjectPresentation.Examples.Contracts.csproj">
      <Project>{A67CF605-451F-4716-8CC1-C333381D7C5C}</Project>
      <Name>ObjectPresentation.Examples.Contracts</Name>
    </ProjectReference>
    <ProjectReference Include="..\ObjectPresentation\ObjectPresentation.csproj">
      <Project>{CB3716D5-0295-4E73-B38F-F655C397E7EA}</Project>
      <Name>ObjectPresentation</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shmuel Zang
Software Developer
Israel Israel
No Biography provided
Follow on   LinkedIn

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 5 Jan 2012
Article Copyright 2012 by Shmuel Zang
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid