Ejemplo n.º 1
0
        public TreeRowView(ITreeRowViewModel model, Func <IObservable <int>, IObservable <Points> > rowOffsetToTop)
        {
            _model       = model;
            _indentation = model.Depth.Select(GetIndentation).Replay(1).RefCount();

            var top  = RectangleEdge.Top.FlipVerticallyOnMac();
            var down = Axis2DExtensions.ShouldFlip ? -1.0 : 1.0;

            var frameVerticalInterval = rowOffsetToTop(model.RowOffset)
                                        .CombineLatest(
                _model.ExpandedDescendantCount,
                (rowTop, expandedDescendantCount) =>
                Rectangle.Zero <Points>()
                .WithEdge(top, rowTop)
                .WithEdge(top.Opposite(), rowTop.Add((expandedDescendantCount + 1) * Height * down))
                .VerticalInterval)
                                        .Transpose()
                                        .Replay(1)
                                        .RefCount();

            Background =
                VerticalLine(Theme.OutlineVerticalLineBackground)
                .WithFrame(x => x.WithAxis(Axis2D.Vertical, frameVerticalInterval));

            Foreground =
                Header()
                .WithBackground(HitRect())
                .WithBackground(SelectionIndicator())
                .DockTop()
                .WithFrame(x => x.WithAxis(Axis2D.Vertical, frameVerticalInterval));

            var highlightBrush =
                _model.IsFaded.Select(isFaded => isFaded ? Theme.PanelBackground.WithAlpha(0.5f) : Color.Transparent).Switch();

            Overlay =
                VerticalLine(Color.FromBytes(255, 255, 255, 30))
                .WithOverlay(Shapes.Rectangle(fill: highlightBrush).WithHeight(Height).DockTop())
                .WithFrame(x => x.WithAxis(Axis2D.Vertical, frameVerticalInterval));
        }
Ejemplo n.º 2
0
 static TreeRowView CreateRow(ITreeRowViewModel model, Func <IObservable <int>, IObservable <Points> > rowOffsetToTop)
 {
     return(new TreeRowView(model, rowOffsetToTop));
 }