public ListItemBlockView(DocumentEditorContextView root, ListItemBlock listItemBlock)
        {
            _root          = root;
            _listItemBlock = listItemBlock;
            _childContents = new StackPanel();
            SetRow(_childContents, 0);
            SetColumn(_childContents, 1);

            _listSymbol      = new TextBlock();
            _listSymbol.Text = " - ";
            SetRow(_listSymbol, 0);
            SetColumn(_listSymbol, 0);

            Children.Add(_listSymbol);
            Children.Add(_childContents);

            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            foreach (var block in listItemBlock.Children)
            {
                var view = _root.CreateViewFor(block);
                Children.Add(view);
            }
        }
Exemplo n.º 2
0
        public HeadingBlockView(DocumentEditorContextView root, HeadingBlock block)
            : base(root, block)
        {
            _block     = block;
            _block.Tag = this;
            Padding    = new Thickness(10);

            SyncTextSize();
            //Text.TextFont = new Typeface("Segoe UI Semibold");
        }
        public VerticalBlockCollectionView(DocumentEditorContextView root, RootBlockCollection blockCollection)
        {
            _root                = root;
            _blockCollection     = blockCollection;
            _blockCollection.Tag = this;

            foreach (var block in _blockCollection.Children)
            {
                Children.Add(_root.CreateViewFor(block));
            }
        }
        public static MeasuredRectangle MeasureSelectionBounds(DocumentEditorContextView root, FrameworkElement self)
        {
            var offset = self.TransformToAncestor(root).Transform(new Point(0, 0));

            return(new MeasuredRectangle()
            {
                X = offset.X,
                Y = offset.Y,
                Width = self.ActualWidth,
                Height = self.ActualHeight
            });
        }
Exemplo n.º 5
0
        /// <summary> Constructor. </summary>
        /// <param name="root"> The root view that this TextBox is ultimately a part of. </param>
        /// <param name="block"> The block that this view is for. </param>
        protected internal BaseTextBlockView(DocumentEditorContextView root, TextBlock block)
        {
            _root      = root;
            _block     = block;
            _renderer  = new CustomStringRenderer(this, block);
            _block.Tag = this;

            _block.SubscribeListener(this);

            TextBlockChanged(null, _block.Content);

            RecreateText();
        }
        /// <summary> Gets a view that can be used for the given block. </summary>
        public FrameworkElement GetViewFor(DocumentEditorContextView context, Block block)
        {
            if (!_lookup.TryGetValue(block.GetType(), out var creator))
            {
                throw new KeyNotFoundException()
                      {
                          Data = { { "Key", block.GetType() } }
                      }
            }
            ;

            return(creator.Invoke(context, block));
        }
    }
Exemplo n.º 7
0
 /// <summary> Constructor. </summary>
 /// <param name="ownerView"> The visual that is performing the hit test. </param>
 public BlockSearchHitTester(DocumentEditorContextView ownerView)
 {
     _ownerView             = ownerView;
     _hitTestFilterCallback = FilterCallback;
     _hitTestResultCallback = ResultCallback;
 }