Setting style on first and last visible TabItem of TabControl?

Public Window1() { InitializeComponent(); this.myTabItem. IsVisibleChanged += new DependencyPropertyChangedEventHandler(myTabItem_IsVisibleChanged); } private void myTabItem_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { myTabControl. Items0.

Style = FindResource("MyTabItemStyle") as Style; } This is simple if you programmatically add the tab items to your control... :).

2 As a mental image, each TabItem is an arrow shape | > > > | but the first and last ones have square ends. If TabItem 0 becomes not visible, then TabItem 1 must have the square style. The visibility of TabItems is controlled through binding.

The TabItems will not scroll out of view. – Donnelle Oct 15 '08 at 20:27.

Note that the visibility of our TabItems will not be affected while that TabControl is in view, so we can apply styles only when the TabControl visibility changes. Private void Breadcrumb_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e. NewValue) { if (sender is TabControl) { TabControl tabControl = (TabControl)sender; int firstVisible = -1; for (int I = 0; I -1) //if is -1, they're all invisible { for (int I = tabControl.Items.

Count - 1; I > firstVisible; i--) { TabItem tabItem = (TabItem)tabControl. Itemsi; if (tabItem. Visibility == Visibility.

Visible) { tabItem. Style = (Style)FindResource("LastBreadcrumbTabItem"); break; } } } } } }.

I have taken the silverlight tabcontrol and made the tabitems scrollable. Here is a link to the post. I think this is what you are looking for.

dansoltesz.com/post/2010/07/20/Silverlig....

I want to set a style on the first and last TabItems in a TabControl, and have them updated as the visibility of the TabItems is changed. I can't see a way to do so with triggers. And the visibility of TabItems are determined by binding.

I do have it working in code. On TabItem visibility changed, enumerate through TabItems until you find the first visible one. Set the style on that one.

For all other visible TabItems, set them to the pointy style (so that the previously first visible one is now pointy). Then start from the end until you find a visible TabItem and set the last style on that one. There's undoubtably improvements I could make to my method, but I'm not convinced that it IS the right approach.

How would you approach this?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions