public void RowCompositeBinding_XAML() { var dataSet = DataSetMock.ProductCategories(1); var _ = dataSet._; RowBinding <Label> label = null; RowBinding <TextBlock> textBlock = null; RowCompositeBinding <XamlPane> pane = null; var elementManager = dataSet.CreateElementManager(builder => { textBlock = _.Name.BindToTextBlock(); label = _.Name.BindToLabel(textBlock); pane = new RowCompositeBinding <XamlPane>().AddChild(label, v => v.Label).AddChild(textBlock, v => v.TextBlock); builder.GridRows("100").GridColumns("100").AddBinding(0, 0, pane); }); Assert.IsNull(label.SettingUpElement); Assert.IsNull(textBlock.SettingUpElement); Assert.IsNull(pane.GetSettingUpElement()); var currentRow = elementManager.Rows[0]; Assert.AreEqual(pane[currentRow].Children[0], label[currentRow]); Assert.AreEqual(pane[currentRow].Children[1], textBlock[currentRow]); Assert.AreEqual(_.Name.DisplayName, label[currentRow].Content); Assert.AreEqual(currentRow.GetValue(_.Name), textBlock[currentRow].Text); Assert.AreEqual(textBlock[currentRow], label[currentRow].Target); }
/// <summary> /// Adds row binding into <see cref="GridCell"/>. /// </summary> /// <typeparam name="T">The element type of the row binding.</typeparam> /// <param name="rowBinding">The row binding.</param> /// <returns>The row binding object of <see cref="GridCell"/>.</returns> public static RowCompositeBinding <GridCell> AddToGridCell <T>(this RowBindingBase <T> rowBinding) where T : UIElement, new() { if (rowBinding == null) { throw new ArgumentNullException(nameof(rowBinding)); } var result = new RowCompositeBinding <GridCell>(); result.AddChild(rowBinding, v => v.GetChild <T>()); return(result); }