コード例 #1
0
 public LogicalTreeViewModel(Control root)
 {
     Nodes    = LogicalTreeNode.Create(root);
     _details = this.WhenAnyValue(x => x.SelectedNode)
                .Select(x => x != null ? new ControlDetailsViewModel(x.Control) : null)
                .ToProperty(this, x => x.Details);
 }
コード例 #2
0
        public DevToolsViewModel(IControl root)
        {
            _root        = root;
            _logicalTree = new TreePageViewModel(LogicalTreeNode.Create(root));
            _visualTree  = new TreePageViewModel(VisualTreeNode.Create(root));

            this.WhenAnyValue(x => x.SelectedTab).Subscribe(index =>
            {
                switch (index)
                {
                case 0:
                    Content = _logicalTree;
                    break;

                case 1:
                    Content = _visualTree;
                    break;
                }
            });

            _focusedControl = KeyboardDevice.Instance
                              .WhenAnyValue(x => x.FocusedElement)
                              .Select(x => x?.GetType().Name)
                              .ToProperty(this, x => x.FocusedControl);

            _pointerOverElement = root.GetObservable(TopLevel.PointerOverElementProperty)
                                  .Select(x => x?.GetType().Name)
                                  .ToProperty(this, x => x.PointerOverElement);
        }
コード例 #3
0
ファイル: LogicalTreeView.cs プロジェクト: rdterner/Perspex
        private Control GetHeader(LogicalTreeNode node)
        {
            var result = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Gap = 8,
                Children = new Controls
                {
                    new TextBlock
                    {
                        Text = node.Type,
                    },
                    new TextBlock
                    {
                        [!TextBlock.TextProperty] = node.WhenAnyValue(x => x.Classes),
                    }
                }
            };

            result.PointerEnter += AddAdorner;
            result.PointerLeave += RemoveAdorner;

            return result;
        }