This is a migrated thread and some comments may be shown as answers.

Disable close button for single tab

17 Answers 693 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 25 Oct 2010, 12:51 PM
We want to show the close button on some tabs in the PageView, but not all. Can the closebutton visibility be specified pr tab, instead of as a property on the parent PageView?

17 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 27 Oct 2010, 02:25 PM
Hello Marius,

Sorry about the delay, to achieve this result you can use this method:
private void HideCloseButtonForPage(RadPageViewPage page)
{
    var pageViewStripElement = ((Telerik.WinControls.UI.RadPageViewContentAreaElement)((radPageView1.ViewElement).ContentArea)).Owner as RadPageViewStripElement;
    var stripItem = ((Telerik.WinControls.UI.RadPageViewElement)(pageViewStripElement)).Items.Where(item => item.Page == page).FirstOrDefault();
    if (stripItem != null)
    {
        stripItem.ButtonsPanel.SetValue(LightVisualElement.VisibilityProperty, Telerik.WinControls.ElementVisibility.Collapsed);
        stripItem.ButtonsPanel.SetDefaultValueOverride(LightVisualElement.VisibilityProperty, Telerik.WinControls.ElementVisibility.Collapsed);
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Emanuel Varga
Top achievements
Rank 1
answered on 29 Oct 2010, 09:03 AM
Hello again Marius,

I just wanted to ask if the example i provided helped you achieve the desired effect.

If you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Marius
Top achievements
Rank 1
answered on 29 Oct 2010, 12:07 PM
It worked perfectly, thank you.
0
Gustavo
Top achievements
Rank 1
answered on 29 Oct 2010, 04:33 PM
Hi Emanuel.
I need exactly the same as Marius, I copied the code you post, but is not working for me.
I just debugged the code, line by line, and everyhing seems to be fine. Nothing is null, entering in all code paths, etc.

But the close button is still working at RadPageView level, I mean, for all tabs depending on the RadPageView.ViewElement.StripButtons property settings.

Am I missing something? might be missing a setting at the radpageview properties?

Thanks

Gustavo
0
Gustavo
Top achievements
Rank 1
answered on 29 Oct 2010, 05:02 PM
Hi Emanuel.
On my previous post, I think I was confusing between the RadPageView.ViewElement.StripButton property and the StripElement level.

Now I just set RadPageView.ViewElement.StripButton to "false", and using your code, everything is working perfectly.

Very useful code.

Thanks

Gustavo

0
Kirk Couser
Top achievements
Rank 1
answered on 01 Dec 2010, 10:44 PM
Shouldn't using this line:

SomePageView.ViewElement.ShowItemCloseButton = false;

Set the close button visibility to false?  It is not in my case.
0
Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 12:05 PM
Hello,

This is set to false by default in Strip mode. Setting this to trrue will show a X (close button) on each tab.
Hope that helps
Richard
0
Kirk Couser
Top achievements
Rank 1
answered on 02 Dec 2010, 03:10 PM
I have my page view in strip mode, but the close button still shows regardless that why I asked about that line of code.  I'm using the latest release in Visual Studio 2010 on a .NET 3.5 Windows App.
0
Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 03:22 PM
Kirk,

This will also hide the X on the strip
Me.RadPageView1.ViewElement.Children(0).Children(1).Children(3).Visibility = ElementVisibility.Collapsed

hope that helps
Richard
0
Kirk Couser
Top achievements
Rank 1
answered on 02 Dec 2010, 03:41 PM
That didn't work for me either, both the arrows and close button still show.  I'm using the page view like a wizard with command buttons to cycle through the page views so having those buttons there is confusing the end users of the app.
0
Kirk Couser
Top achievements
Rank 1
answered on 02 Dec 2010, 03:43 PM
Nevermind I figured it out, if you go into designer mode on your page view, drill down into the ViewElement and then set StripButtons to None it will make them go away.
0
Chad
Top achievements
Rank 2
answered on 08 Dec 2010, 01:52 PM

I also wanted to now how to hide specific buttons on a tab. Your suggestion worked:

tabOrder.ViewElement.Children(0).Children(1).Children(3).Visibility = ElementVisibility.Collapsed

Yet I would like to understand it.

The Help file explains basic stuff, and when I search for less traveled topics like this and most others, I get genererated documentation that is of no help.
I have a Page view with a few tabs. What do all these nested collections refer to? How does one go figuring this out?

Edit:

I see the property builder. I think that this is my best shot to understanding the control.
0
Richard Slade
Top achievements
Rank 2
answered on 08 Dec 2010, 02:00 PM
Hi Chad,

RadControls are made up of nested elements (other controls) For exmaple, a radButton would have a border element, a fill primitive element etc.. This is finding the element required to set visibility.

If you go to the Smart Tag of a RadControl and click on Edit UI Elements, then you can see the element hierarchy for the control, and therefore control its properties.

Hope that helps
Richard
0
Dobry Zranchev
Telerik team
answered on 08 Dec 2010, 02:14 PM
Hi Chad,

In addition to Richard's reply I can suggest that you use our RadControlSpy tool. For additional information, please refer to this article.

Regards,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dan
Top achievements
Rank 1
answered on 26 Jun 2012, 04:36 PM
Sorry to bump an old thread, but my issue is so close to this that I thought this would be the best place to address it.

I'd like to remove the close box on one individual tab itself (when ShowItemCloseButton = True).  The tab page is created programmatically.  Is this possible?

P.S. I tried the control spy, but it didn't seem to want to pick up any controls on my MDI form.

Thanks,
Dan

0
Boryana
Telerik team
answered on 29 Jun 2012, 09:30 AM
Hello Dan,

Thank you for writing.

Have you tried the following approach:
RadPageViewPage buttonless = new RadPageViewPage();
buttonless.Text = "Buttonless Page";
this.radPageView1.Pages.Add(buttonless);
buttonless.Item.ButtonsPanel.CloseButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;

Once you have added the page to the Pages collection, you can easily navigate to its CloseButton and set its Visibility to collapsed.

Feel free to write back if you have further queries.

Kind regards,
Boryana
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Dan
Top achievements
Rank 1
answered on 29 Jun 2012, 04:43 PM
Perfect!  Thanks Boryana!
Tags
PageView
Asked by
Marius
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Marius
Top achievements
Rank 1
Gustavo
Top achievements
Rank 1
Kirk Couser
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Chad
Top achievements
Rank 2
Dobry Zranchev
Telerik team
Dan
Top achievements
Rank 1
Boryana
Telerik team
Share this question
or