0

我需要dropdownUltrawintree节点中绑定 a 。当用户双击节点的单元格时,它应该是可编辑的,因此我需要在dropdown. 这样用户就可以选择值并保存/更新。

//代码

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim columnSet As UltraTreeColumnSet = Me.ultraTree1.ColumnSettings.ColumnSets(0)

        '   Use the ActiveCellAppearance to bring attention to the cell
        '   with the input focus
        columnSet.ActiveCellAppearance.BackColor = Color.Red
        columnSet.ActiveCellAppearance.ForeColor = Color.White

        '   Set AllowCellEdit to 'ActivateOnly' so that clicking a cell does
        '   not put in into edit mode immediately
        columnSet.AllowCellEdit = AllowCellEdit.Full

        '   Enable tooltips for cells whose value is not fully visible
        columnSet.TipStyleCell = TipStyleCell.Show
    End Sub

因此,当按钮单击发生时,单元格是完全可编辑的。但不是那样,我需要dropdown在单元格中绑定 a 。那可能吗?

我怎样才能做到这一点?

注意:我使用的是 Infragistics 12.1版

4

1 回答 1

3

有不同的方法来解决这个任务。您可以尝试使用 UltraTree 节点的 EditorComponent 属性。通过这种方式,您可以将 UltraComboEditor 控件分配给节点,这将显示您的下拉值。例如:

this.ultraTree1.Override.ShowEditorButtons = ShowEditorButtons.Always;
        this.ultraTree1.Override.LabelEdit = Infragistics.Win.DefaultableBoolean.True;
        this.ultraTree1.Override.UseEditor = DefaultableBoolean.True;

        DataTable dt = new DataTable("Tabl");
        dt.Columns.Add("X", typeof(Boolean));
        dt.Columns.Add("Y", typeof(String));
        dt.Rows.Add(true, "Test A");
        dt.Rows.Add(false, "Test B");
        dt.Rows.Add(false, "Test C");
        dt.Rows.Add(true, "Test D");

        ultraCombo1.DataSource = dt;
        ultraCombo1.DisplayMember = "Y";
        ultraCombo1.ValueMember = "Y";
        this.ultraTree1.NodeLevelOverrides[0].EditorComponent = ultraCombo1;

如果您使用的是 UltraControlContainerEditor,可能会更复杂,也可能更有趣。这是我们在 UltraTree 的节点中实现 Grid 的小示例。例如:

this.ultraTree1.Override.ShowEditorButtons = ShowEditorButtons.Always;
        this.ultraTree1.Override.LabelEdit = Infragistics.Win.DefaultableBoolean.True;
        this.ultraTree1.Override.UseEditor = DefaultableBoolean.True;


        UltraControlContainerEditor ucc = new Infragistics.Win.UltraWinEditors.UltraControlContainerEditor();
        UltraGrid uc = new UltraGrid();
        UltraGrid uc2 = new UltraGrid();

        DataTable dt = new DataTable("Tabl");
        dt.Columns.Add("X", typeof(Boolean));
        dt.Columns.Add("Y", typeof(String));
        dt.Rows.Add(true, "Test A");
        dt.Rows.Add(false, "Test B");
        dt.Rows.Add(false, "Test C");
        dt.Rows.Add(true, "Test D");

        uc2.DataSource = dt;
        uc.DataSource = dt;

        ucc.RenderingControl = uc2;
        ucc.EditingControl = uc;
        this.ultraTree1.NodeLevelOverrides[1].EditorComponent = ucc;

请查看屏幕截图以查看结果

在此处输入图像描述

于 2013-07-10T13:09:31.987 回答