WPF模式中的面板重叠问题

时间:2017-12-12 13:52:04

标签: c# wpf

我正在使用System.Windows.Forms.Panel创建面板,它包含下拉列表中动态加载的数据。

专家组代码:

    this.panel1 = new Panel();
    this.panel1.Location = new System.Drawing.Point(0, 0);
    this.panel1.Size = new System.Drawing.Size(300, 20);
    this.Controls.Add(this.panel1);

    this.panel2 = new Panel();
    this.panel2.Location = new System.Drawing.Point(0, 20);
    this.panel2.Size = new System.Drawing.Size(300, 250);
    Controls.Add(this.panel2);

    this.panelLblDisplay = new System.Windows.Forms.Label();
    this.panelLblDisplay.Location = new System.Drawing.Point(0, 0);
    this.panelLblDisplay.Name = "panelLblDisplay";
    this.panelLblDisplay.Text = "Item";
    this.panelLblDisplay.Size = new System.Drawing.Size(75, 20);
    this.panelLblDisplay.TextAlign = ContentAlignment.MiddleRight;
    this.panel1.Controls.Add(this.panelLblDisplay);

    this.panelDisplay = new TextBox();
    this.panelDisplay.Location = new System.Drawing.Point(80, 0);
    this.panelDisplay.Name = "panelDisplay";
    this.panelDisplay.ReadOnly = true;
    this.panelDisplay.Size = new System.Drawing.Size(201, 20);
    this.panel1.Controls.Add(this.panelDisplay);

    this.btnExpand = new Button();
    this.btnExpand.Location = new System.Drawing.Point(281, 0);
    this.btnExpand.BackgroundImage = Properties.Resources.DropDownButton;
    this.btnExpand.Size = new System.Drawing.Size(19, 21);
    this.panel1.Controls.Add(this.btnExpand);

    this._tvItem = new TreeView();
    this._tvItem.Location = new System.Drawing.Point(80, 0);
    this._tvItem.Name = "_tvItem";
    this._tvItem.Size = new System.Drawing.Size(220, 250);
    this.panel2.Controls.Add(this._tvItem);

在wpf模式下,当我点击面板按钮时,数据正在加载但是,它正在其他控件下隐藏(重叠)。我看不到数据。但是,当我将此面板控件放在表单的末尾时,我能够看到数据。但是,如果我将此面板控件置于其他控件(文本框,菜单栏)之间,则下拉正在隐藏。

任何人都可以就此提出建议。此问题仅在WPF模式下出现。

0 个答案:

没有答案