public void RetrieveFields(DataLayoutControl lc) { lc.Clear(); LayoutElementsBindingInfoHelper bindingHelper = new LayoutElementsBindingInfoHelper(lc); LayoutElementsBindingInfo info; info = bindingHelper.CreateDataLayoutElementsBindingInfo(); bindingHelper.FillWithSuggestedValues(info); List <LayoutElementBindingInfo> bindingsInfo = info.GetAllBindings(); foreach (LayoutElementBindingInfo bindingInfo in bindingsInfo) { if (bindingInfo.DataInfo.Name == "Description") { bindingInfo.EditorType = typeof(MemoEdit); break; } } LayoutCreator creator = new LayoutCreator(lc); creator.CreateLayout(info); foreach (BaseLayoutItem item in lc.Items) { if (item is LayoutControlItem) { Control c = (item as LayoutControlItem).Control; if (c.DataBindings[0].BindingMemberInfo.BindingMember == "Description") { (item as LayoutControlItem).SizeConstraintsType = SizeConstraintsType.Custom; (item as LayoutControlItem).MinSize = new Size(0, 100); } } } }
public void layoutCreatorForNullJason() { LayoutCreator layoutCreator = new LayoutCreator(); ILayout iLayout = layoutCreator.CreateLayout(Constants.Jason); var dataGrid = new DataGrid(); dataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.ExcludeHeader; //dataGrid.ItemsSource = new List<Post>() { // new Post() { id = 1, body="body", title="title" , userId = 1 }, // new Post() { id = 1, body="body", title="title" , userId = 2 } //}; iLayout.GetLayout(dataGrid); }
public void layoutCreatorForText() { _iLayout = _layoutCreator.CreateLayout(Constants.Text); var dataGrid = new DataGrid(); dataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.ExcludeHeader; dataGrid.ItemsSource = new List <Post>() { new Post() { id = 1, body = "body", title = "title", userId = 1 }, new Post() { id = 1, body = "body", title = "title", userId = 2 } }; _iLayout.GetLayout(dataGrid); Assert.IsTrue(dataGrid.SelectedIndex == 0); }
public void layoutCreatorForDefault() { LayoutCreator layoutCreator = new LayoutCreator(); ILayout iLayout = layoutCreator.CreateLayout("Default"); var dataGrid = new DataGrid(); dataGrid.ClipboardCopyMode = DataGridClipboardCopyMode.ExcludeHeader; dataGrid.ItemsSource = new List <Post>() { new Post() { id = 1, body = "body", title = "title", userId = 1 }, new Post() { id = 1, body = "body", title = "title", userId = 2 } }; iLayout.GetLayout(dataGrid); Assert.IsTrue(dataGrid.SelectedIndex == 0); }