A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.1 KiB

// -----------------------------------------------------------------------
// <copyright file="VisualTreeNode.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Diagnostics.ViewModels
{
using Perspex.Controls;
using ReactiveUI;
internal class VisualTreeNode : ReactiveObject
{
public VisualTreeNode(IVisual visual)
{
this.Children = visual.VisualChildren.CreateDerivedCollection(x => new VisualTreeNode(x));
this.Type = visual.GetType().Name;
this.Visual = visual;
Control control = visual as Control;
if (control != null)
{
this.IsInTemplate = control.TemplatedParent != null;
}
}
public IReactiveDerivedList<VisualTreeNode> Children { get; private set; }
public bool IsInTemplate { get; private set; }
public string Type { get; private set; }
public IVisual Visual { get; private set; }
}
}