コード例 #1
0
ファイル: LayoutManager.cs プロジェクト: xydoublez/RDO.Net
        internal Rect GetRect(ScalarBinding scalarBinding, int flowIndex)
        {
            var point = GetPosition(scalarBinding, flowIndex);
            var size  = GetSize(scalarBinding);

            return(new Rect(point, size));
        }
コード例 #2
0
 public TypedAttachedScalarBinding(Template template, T element, ScalarBinding <T> baseBinding)
     : base(template)
 {
     _element = element;
     s_bindingsByElement.Add(element, this);
     _baseBinding = baseBinding;
     _baseBinding.Seal(this, 0);
 }
コード例 #3
0
ファイル: InPlaceEditor.cs プロジェクト: xydoublez/RDO.Net
        internal static ScalarBinding <InPlaceEditor> AddToInPlaceEditor <TEditing, TInert>(ScalarInput <TEditing> scalarInput, ScalarBinding <TInert> inertScalarBinding)
            where TEditing : UIElement, new()
            where TInert : UIElement, new()
        {
            var result = new ScalarBinding <InPlaceEditor>((Action <InPlaceEditor>)null);

            result.Input = new ProxyScalarInput <TEditing, TInert>(result, scalarInput, inertScalarBinding);
            return(result);
        }
コード例 #4
0
ファイル: InPlaceEditor.cs プロジェクト: xydoublez/RDO.Net
        private static UIElement GenerateElement(ScalarBinding binding, int flowIndex)
        {
            binding.BeginSetup(null);
            var result = binding.Setup(flowIndex);

            binding.EndSetup();
            binding.Refresh(result);
            return(result);
        }
コード例 #5
0
 private int InsertScalarElementsAfter(ScalarBinding scalarBinding, int index, int count)
 {
     for (int i = 0; i < count; i++)
     {
         var element = scalarBinding.Setup(scalarBinding.FlowRepeatCount - count + i);
         ElementCollection.Insert(index + i + 1, element);
     }
     return(index + count);
 }
コード例 #6
0
 internal void AddBinding(GridRange gridRange, ScalarBinding scalarBinding)
 {
     Debug.Assert(IsValid(gridRange));
     scalarBinding.Seal(this, gridRange, InternalScalarBindings.Count);
     InternalScalarBindings.Add(gridRange, scalarBinding);
     if (!HasRowBinding)
     {
         ScalarBindingsSplit = InternalScalarBindings.Count;
     }
 }
コード例 #7
0
ファイル: InputManager.cs プロジェクト: xydoublez/RDO.Net
        private bool TryFocus(ScalarBinding scalarBinding, int flowIndex)
        {
            var element = scalarBinding[flowIndex];

            if (element.IsKeyboardFocusWithin)
            {
                return(true);
            }
            return(element.Focus());
        }
コード例 #8
0
 private void RemoveScalarElementsAfter(ScalarBinding scalarBinding, int index, int count)
 {
     for (int i = 0; i < count; i++)
     {
         var element = Elements[index + 1];
         Debug.Assert(element.GetBinding() == scalarBinding);
         scalarBinding.Cleanup(element);
         ElementCollection.RemoveAt(index + 1);
     }
 }
コード例 #9
0
ファイル: InPlaceEditor.cs プロジェクト: xydoublez/RDO.Net
 public ProxyScalarInput(ScalarBinding <InPlaceEditor> binding, ScalarInput <TEditor> editorInput, ScalarBinding <TInert> inertBinding)
     : base(binding, new ExplicitTrigger <InPlaceEditor>(), null)
 {
     Debug.Assert(editorInput != null);
     Debug.Assert(inertBinding != null);
     _editorInput  = editorInput;
     _inertBinding = inertBinding;
     _editorInput.InjectScalarValidation(this);
     InertBinding.Seal(binding, 0);
     EditorBinding.Seal(binding, 1);
 }
コード例 #10
0
        public void InputManager_ScalarInput()
        {
            var            dataSet = DataSetMock.ProductCategories(3, false);
            var            _       = dataSet._;
            Scalar <Int32> scalar  = ScalarContainerMock.New().CreateNew <int>().AddValidator(x =>
            {
                return(x > 5 ? "Value cannot be greater than 5." : null);
            });
            ScalarBinding <TextBox> textBox   = null;
            RowBinding <TextBlock>  textBlock = null;
            var inputManager = dataSet.CreateInputManager((builder) =>
            {
                textBox   = scalar.BindToTextBox();
                textBlock = _.Name.BindToTextBlock(); // to avoid empty RowRange
                builder.GridColumns("100").GridRows("100", "100").AddBinding(0, 0, textBox).AddBinding(0, 1, textBlock);
            }).WithScalars(new Scalar[] { scalar });

            Assert.AreEqual("0", textBox[0].Text);
            Assert.IsNull(inputManager.ScalarValidation.GetFlushingError(textBox[0]));
            {
                var errors = System.Windows.Controls.Validation.GetErrors(textBox[0]);
                Assert.AreEqual(0, errors.Count);
            }

            textBox[0].Text = "A";
            Assert.IsNotNull(inputManager.ScalarValidation.GetFlushingError(textBox[0]));
            {
                var errors = System.Windows.Controls.Validation.GetErrors(textBox[0]);
                Assert.AreEqual(1, errors.Count);
                Assert.AreEqual(inputManager.ScalarValidation.GetFlushingError(textBox[0]), errors[0].ErrorContent);
            }

            textBox[0].Text = "4";
            Assert.IsNull(inputManager.ScalarValidation.GetFlushingError(textBox[0]));
            Assert.AreEqual(4, scalar.GetValue());
            Assert.IsNull(inputManager.ScalarValidation.GetFlushingError(textBox[0]));
            {
                var errors = System.Windows.Controls.Validation.GetErrors(textBox[0]);
                Assert.AreEqual(0, errors.Count);
            }

            inputManager.ScalarValidation.UpdateProgress(textBox.Input, true, true);
            textBox[0].Text = "6";
            Assert.AreEqual("6", textBox[0].Text);
            Assert.AreEqual(1, inputManager.ScalarValidation.Errors.Count);
            {
                var errors = System.Windows.Controls.Validation.GetErrors(textBox[0]);
                Assert.AreEqual(1, errors.Count);
                Assert.AreEqual(inputManager.ScalarValidation.Errors, errors[0].ErrorContent);
            }
        }
コード例 #11
0
        internal void AddBinding <T>(T element, ScalarBinding <T> scalarBinding)
            where T : UIElement, new()
        {
            element.VerifyNotNull(nameof(element));
            if (element.IsAttachedToScalarBinding())
            {
                throw new ArgumentException(DiagnosticMessages.Template_ElementAttachedAlready, nameof(element));
            }
            scalarBinding.VerifyNotNull(nameof(scalarBinding));
            if (scalarBinding.IsSealed)
            {
                throw new ArgumentException(DiagnosticMessages.Binding_VerifyNotSealed, nameof(scalarBinding));
            }

            var result = AttachedScalarBinding.Attach(this, element, scalarBinding);

            if (_attachedScalarBindings == null)
            {
                _attachedScalarBindings = new List <AttachedScalarBinding>();
            }
            _attachedScalarBindings.Add(result);
        }
コード例 #12
0
ファイル: LayoutManager.cs プロジェクト: xydoublez/RDO.Net
 protected abstract Size GetSize(ScalarBinding scalarBinding);
コード例 #13
0
ファイル: LayoutManager.cs プロジェクト: xydoublez/RDO.Net
 internal abstract Thickness GetFrozenClip(ScalarBinding scalarBinding, int flowIndex);
コード例 #14
0
 internal override Thickness GetFrozenClip(ScalarBinding scalarBinding, int flowIndex)
 {
     return(new Thickness());
 }
コード例 #15
0
 protected override Size GetSize(ScalarBinding scalarBinding)
 {
     return(scalarBinding.GridRange.MeasuredSize);
 }
コード例 #16
0
 protected override Point GetPosition(ScalarBinding scalarBinding, int flowIndex)
 {
     Debug.Assert(flowIndex == 0);
     return(scalarBinding.GridRange.MeasuredPosition);
 }
コード例 #17
0
ファイル: LayoutManager.cs プロジェクト: xydoublez/RDO.Net
 protected abstract Point GetPosition(ScalarBinding scalarBinding, int flowIndex);
コード例 #18
0
        public void ElementManager_Elements()
        {
            var dataSet = DataSetMock.ProductCategories(8, false);
            var _       = dataSet._;
            ScalarBinding <TextBlock> columnHeader1 = null;
            BlockBinding <TextBlock>  blockHeader   = null;
            RowBinding <TextBlock>    textBlock     = null;
            ScalarBinding <TextBlock> columnHeader2 = null;
            var elementManager = dataSet.CreateElementManager((builder) =>
            {
                columnHeader1 = _.Name.AsScalarTextBlock();
                blockHeader   = _.AsBlockHeader();
                textBlock     = _.Name.BindToTextBlock();
                columnHeader2 = _.Name.AsScalarTextBlock().RepeatWhenFlow();
                builder.GridColumns("100", "100")
                .GridRows("100", "100", "100")
                .Layout(Orientation.Vertical, 0)
                .AddBinding(1, 0, columnHeader1)
                .AddBinding(0, 1, blockHeader)
                .AddBinding(1, 1, textBlock)
                .AddBinding(1, 2, columnHeader2);
            });

            {
                var template = elementManager.Template;
                var rows     = elementManager.Rows;

                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(3, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    var blockView = (BlockView)elements[1];
                    Assert.AreEqual(2, blockView.Elements.Count);
                    Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                    var rowView = (RowView)blockView.Elements[1];
                    Assert.AreEqual(1, rowView.Elements.Count);
                    Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                    Assert.AreEqual(columnHeader2[0], elements[2]);
                }

                elementManager.FlowRepeatCount = 3;
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(5, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    var blockView = (BlockView)elements[1];
                    Assert.AreEqual(4, blockView.Elements.Count);
                    Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                    {
                        var rowView = (RowView)blockView.Elements[1];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                    }
                    {
                        var rowView = (RowView)blockView.Elements[2];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                    }
                    {
                        var rowView = (RowView)blockView.Elements[3];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                    }
                    Assert.AreEqual(columnHeader2[0], elements[2]);
                    Assert.AreEqual(columnHeader2[1], elements[3]);
                    Assert.AreEqual(columnHeader2[2], elements[4]);
                    Assert.AreNotEqual(columnHeader2[0], columnHeader2[1]);
                    Assert.AreNotEqual(columnHeader2[0], columnHeader2[2]);
                    Assert.AreNotEqual(columnHeader2[1], columnHeader2[2]);
                }

                elementManager.ContainerViewList.RealizeFirst(1);
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(6, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[4]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[5]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[3]);
                    Assert.AreEqual(columnHeader2[1], elements[4]);
                    Assert.AreEqual(columnHeader2[2], elements[5]);
                }

                elementManager.ContainerViewList.RealizePrev();
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(6, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[4]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[5]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[3]);
                    Assert.AreEqual(columnHeader2[1], elements[4]);
                    Assert.AreEqual(columnHeader2[2], elements[5]);
                }

                elementManager.ContainerViewList.RealizeNext();
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(7, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(4, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[4]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[3];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[5]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[3];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[2], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[6]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[7]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[4]);
                    Assert.AreEqual(columnHeader2[1], elements[5]);
                    Assert.AreEqual(columnHeader2[2], elements[6]);
                }

                elementManager.FlowRepeatCount = 2;
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(4, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    var blockView = (BlockView)elements[1];
                    Assert.AreEqual(3, blockView.Elements.Count);
                    Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                    {
                        var rowView = (RowView)blockView.Elements[1];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                    }
                    {
                        var rowView = (RowView)blockView.Elements[2];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                    }
                    Assert.AreEqual(columnHeader2[0], elements[2]);
                    Assert.AreEqual(columnHeader2[1], elements[3]);
                    Assert.AreNotEqual(columnHeader2[0], columnHeader2[1]);
                }

                elementManager.ContainerViewList.RealizeFirst(1);
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(5, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[3]);
                    Assert.AreEqual(columnHeader2[1], elements[4]);
                }

                elementManager.ContainerViewList.RealizePrev();
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(5, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[3]);
                    Assert.AreEqual(columnHeader2[1], elements[4]);
                }

                elementManager.ContainerViewList.RealizeNext();
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(6, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    {
                        var blockView = (BlockView)elements[1];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[2];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[1], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[2]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[3]], rowView.Elements[0]);
                        }
                    }
                    {
                        var blockView = (BlockView)elements[3];
                        Assert.AreEqual(3, blockView.Elements.Count);
                        Assert.AreEqual(blockHeader[2], blockView.Elements[0]);
                        {
                            var rowView = (RowView)blockView.Elements[1];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[4]], rowView.Elements[0]);
                        }
                        {
                            var rowView = (RowView)blockView.Elements[2];
                            Assert.AreEqual(1, rowView.Elements.Count);
                            Assert.AreEqual(textBlock[rows[5]], rowView.Elements[0]);
                        }
                    }
                    Assert.AreEqual(columnHeader2[0], elements[4]);
                    Assert.AreEqual(columnHeader2[1], elements[5]);
                }

                elementManager.ContainerViewList.VirtualizeAll();
                {
                    var elements = elementManager.Elements;
                    Assert.AreEqual(4, elements.Count);
                    Assert.AreEqual(columnHeader1[0], elements[0]);
                    var blockView = (BlockView)elements[1];
                    Assert.AreEqual(3, blockView.Elements.Count);
                    Assert.AreEqual(blockHeader[0], blockView.Elements[0]);
                    {
                        var rowView = (RowView)blockView.Elements[1];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[0]], rowView.Elements[0]);
                    }
                    {
                        var rowView = (RowView)blockView.Elements[2];
                        Assert.AreEqual(1, rowView.Elements.Count);
                        Assert.AreEqual(textBlock[rows[1]], rowView.Elements[0]);
                    }
                    Assert.AreEqual(columnHeader2[0], elements[2]);
                    Assert.AreEqual(columnHeader2[1], elements[3]);
                }

                elementManager.ClearElements();
                Assert.IsNull(elementManager.Elements);
            }
        }
コード例 #19
0
 internal static AttachedScalarBinding Attach <T>(Template template, T element, ScalarBinding <T> baseBinding)
     where T : UIElement, new()
 {
     Debug.Assert(template != null);
     Debug.Assert(element != null && !element.IsAttachedToScalarBinding());
     Debug.Assert(baseBinding != null && !baseBinding.IsSealed);
     return(new TypedAttachedScalarBinding <T>(template, element, baseBinding));
 }