Browse Source

DevTools now displays the visual tree!

pull/4/head
Steven Kirk 12 years ago
parent
commit
e1329ff4ca
  1. 2
      Perspex.Controls/Control.cs
  2. 3
      Perspex.Diagnostics/DevTools.cs
  3. 14
      Perspex.Diagnostics/Perspex.Diagnostics.csproj
  4. 8
      Perspex.Diagnostics/packages.config

2
Perspex.Controls/Control.cs

@ -204,7 +204,7 @@ namespace Perspex.Controls
protected virtual DataTemplate FindDataTemplate(object content)
{
// TODO: This needs to traverse the logical tree, not the visual.
foreach (var i in this.GetVisualAncestors().OfType<Control>())
foreach (var i in this.GetSelfAndVisualAncestors().OfType<Control>())
{
foreach (DataTemplate dt in i.DataTemplates.Reverse())
{

3
Perspex.Diagnostics/DevTools.cs

@ -7,6 +7,7 @@
namespace Perspex.Diagnostics
{
using Perspex.Controls;
using System.Reactive.Linq;
public class DevTools : Decorator
{
@ -32,7 +33,7 @@ namespace Perspex.Diagnostics
x => new TextBlock {Text = x.GetType().Name },
x => x.VisualChildren),
},
[TreeView.ItemsProperty] = this[DevTools.RootProperty],
[!TreeView.ItemsProperty] = this[!DevTools.RootProperty].Select(x => new[] { x }),
}
}
};

14
Perspex.Diagnostics/Perspex.Diagnostics.csproj

@ -69,6 +69,20 @@
<Compile Include="Debug.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Portable-Net45+WinRT45+WP8\System.Reactive.Core.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces">
<HintPath>..\packages\Rx-Interfaces.2.1.30214.0\lib\Portable-Net45+WinRT45+WP8\System.Reactive.Interfaces.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Linq">
<HintPath>..\packages\Rx-Linq.2.1.30214.0\lib\Portable-Net45+WinRT45+WP8\System.Reactive.Linq.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.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.

8
Perspex.Diagnostics/packages.config

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Rx-Core" version="2.1.30214.0" targetFramework="portable-net45+win" />
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="portable-net45+win" />
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="portable-net45+win" />
<package id="Rx-Main" version="2.1.30214.0" targetFramework="portable-net45+win" />
<package id="Rx-PlatformServices" version="2.1.30214.0" targetFramework="portable-net45+win" />
</packages>
Loading…
Cancel
Save