Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I figured out a way to do this with a behavior. I would have preferred a cleaner solution such as a binding, but it works.</p> <pre><code> &lt;telerik:RadTabControl x:Name="myRadTabControl"&gt; &lt;telerik:RadTabControl.ItemTemplate&gt; &lt;!-- Tab Item Header --&gt; &lt;DataTemplate&gt; &lt;TextBlock&gt; &lt;i:Interaction.Behaviors&gt; &lt;Behaviors:MakeLastTabItemInvisible ParentRadTabControl="{Binding ElementName=myRadTabControl}" /&gt; &lt;/i:Interaction.Behaviors&gt; &lt;/TextBlock&gt; &lt;/DataTemplate&gt; &lt;/telerik:RadTabControl&gt; &lt;/telerik:RadTabControl x:Name="myRadTabControl"&gt; public class MakeLastTabItemInvisible : Behavior&lt;FrameworkElement&gt; { #region ParentRadTabControl Dependency Property /// &lt;summary&gt; /// ParentRadTabControl /// &lt;/summary&gt; public RadTabControl ParentRadTabControl { get { return (RadTabControl)GetValue(ParentRadTabControlProperty); } set { SetValue(ParentRadTabControlProperty, value); } } /// &lt;summary&gt; /// ParentRadTabControl Dependency Property. /// &lt;/summary&gt; public static readonly DependencyProperty ParentRadTabControlProperty = DependencyProperty.Register( "ParentRadTabControl", typeof(RadTabControl), typeof(MakeLastTabItemInvisible), new PropertyMetadata(new PropertyChangedCallback(ParentRadTabControlChanged))); private static void ParentRadTabControlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MakeLastTabItemInvisible c = d as MakeLastTabItemInvisible; if (c != null) { if (e.NewValue == null) return; var parentTabControl = (RadTabControl)e.NewValue; if (parentTabControl.Items.Count &lt;= 0) return; var lastTabItem = parentTabControl.ItemContainerGenerator.ContainerFromIndex(parentTabControl.Items.Count - 1) as RadTabItem; if (lastTabItem != null) lastTabItem.Visibility = Visibility.Collapsed; } } #endregion } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload