How to expand the auto hide tab programmatically in WPF DockingManager?
You can expand the auto hide tab programmatically by using the SelectTab function in WPF DockingManager. The following code demonstrates the same.
Xaml
<StackPanel Height="30" Orientation="Horizontal">
<!--TextBox-->
<TextBlock Margin="5" Text="Type open to start the autohide animation : " />
<TextBox Name="Txtbox" Width="100" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Text="">
<i:Interaction.Triggers>
<!-- Command Binding -->
<i:EventTrigger EventName="TextChanged">
<i:InvokeCommandAction Command="{Binding OpenCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
</StackPanel>
<syncfusion:DockingManager Grid.Row="1" Name="Docking">
<ContentControl Name="MyTab" syncfusion:DockingManager.DesiredHeightInDockedMode="200" syncfusion:DockingManager.Header="Messages" syncfusion:DockingManager.SideInDockedMode="Left" syncfusion:DockingManager.State="AutoHidden" />
</syncfusion:DockingManager>
C#
/// <summary>
/// Open Command
/// </summary>
private ICommand _opencommand;
/// <summary>
/// Command to Open the Auto Hidden Window
/// </summary>
public ICommand OpenCommand
{
get
{
return _opencommand ?? (_opencommand = new CommandHandler(() => MyAction(), true));
}
}
/// <summary>
/// Perform action to open Auto Hidden Window
/// </summary>
private void MyAction()
{
MainHost host = VisualUtils.FindDescendant(Docking, typeof(MainHost)) as MainHost;
if (host != null)
{
SidePanel leftpanel = host.Template.FindName("PART_LeftPanel", host) as SidePanel;
SidePanel RightPanel = host.Template.FindName("PART_RightPanel", host) as SidePanel;
SidePanel BottomPanel = host.Template.FindName("PART_BottomPanel", host) as SidePanel;
SidePanel TopPanel = host.Template.FindName("PART_TopPanel", host) as SidePanel;
// Call to open the Autohidden Tab
if (leftpanel.TabChildren.Contains(MyTab))
leftpanel.SelectTab(MyTab);
else if (RightPanel.TabChildren.Contains(MyTab))
RightPanel.SelectTab(MyTab);
else if (BottomPanel.TabChildren.Contains(MyTab))
BottomPanel.SelectTab(MyTab);
else if (TopPanel.TabChildren.Contains(MyTab))
TopPanel.SelectTab(MyTab);
}
}
Screenshot
