csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
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.
48 lines
1.6 KiB
48 lines
1.6 KiB
// -----------------------------------------------------------------------
|
|
// <copyright file="DevTools.cs" company="Steven Kirk">
|
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
|
// </copyright>
|
|
// -----------------------------------------------------------------------
|
|
|
|
namespace Perspex.Diagnostics
|
|
{
|
|
using Perspex.Controls;
|
|
using System.Reactive.Linq;
|
|
|
|
public class DevTools : Decorator
|
|
{
|
|
public static readonly PerspexProperty<Control> RootProperty =
|
|
PerspexProperty.Register<DevTools, Control>("Root");
|
|
|
|
public DevTools()
|
|
{
|
|
this.Content = new Grid
|
|
{
|
|
ColumnDefinitions = new ColumnDefinitions
|
|
{
|
|
new ColumnDefinition(1, GridUnitType.Star),
|
|
new ColumnDefinition(3, GridUnitType.Star),
|
|
},
|
|
Children = new Controls
|
|
{
|
|
new TreeView
|
|
{
|
|
DataTemplates = new DataTemplates
|
|
{
|
|
new TreeDataTemplate<IVisual>(
|
|
x => new TextBlock {Text = x.GetType().Name },
|
|
x => x.VisualChildren),
|
|
},
|
|
[!TreeView.ItemsProperty] = this[!DevTools.RootProperty].Select(x => new[] { x }),
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
public Control Root
|
|
{
|
|
get { return this.GetValue(RootProperty); }
|
|
set { this.SetValue(RootProperty, value); }
|
|
}
|
|
}
|
|
}
|
|
|