Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Fixed stack panel header

Answered Fixed stack panel header

Feed from this thread
  • Eljay avatar

    Posted on Jan 5, 2012 (permalink)

    Is it possible to fix the stack panel header? By default, the header text reflects the selected page's text.

    I've attached the header outlined in red. Thanks.
    Attached files

    Reply

  • Answer Stefan Stefan admin's avatar

    Posted on Jan 9, 2012 (permalink)

    Hello Eljay,

    Thank you for writing.

    The text of the stack element is changed when the selected page of the control is changed. In order to make it constant text, you will have to subscribe to the TextChanged event, where you can set your own text. Here is how to do that:
        public Form1()
        {
            InitializeComponent();
     
            RadPageViewStackElement stack = radPageView1.ViewElement as RadPageViewStackElement;
            stack.Header.Text = "Custom text";
             
            stack.Header.TextChanged += new EventHandler(Header_TextChanged);
        }
     
        void Header_TextChanged(object sender, EventArgs e)
        {
            RadPageViewLabelElement label = sender as RadPageViewLabelElement;
            label.Text = "Custom text";
        }
    }

    I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.

    Kind regards,
    Stefan
    the Telerik team

    SP1
    of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Eljay avatar

    Posted on Jan 18, 2012 (permalink)

    This works, Thanks Stefan!

    I also tried doing this by data-binding radPageView.ViewElement.Header.Text to a fixed string property, but it didn't work. Why is that?

    Reply

  • Peter Peter admin's avatar

    Posted on Jan 23, 2012 (permalink)

    Hi Eljay,

    Thank you for writing back.

    The following code demonstrates how to bind this element:

    public partial class Form1 : Form
        {
            public string Text { get; set; }
            public Form1()
            {
                InitializeComponent();
                this.Text = "aaaa";
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
                radPageView1.ViewElement.Header.Visibility = Telerik.WinControls.ElementVisibility.Visible;
                radPageView1.ViewElement.Header.DataBindings.Add("Text", this, "Text", true, DataSourceUpdateMode.OnPropertyChanged);
            }
        }

    I set the element visibility because by default the radPageView.ViewElement.Header element is not visible for some modes. 

    I hope this helps. Don't hesitate to contact us, if you have other questions.

    Regards,
    Peter
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Fixed stack panel header