Is it possible to change the Tab location of the DocumentContainer in DockingManager? Ideally I would like to move the tabs to the bottom. If not, is there an alternative way to accomplish the same layout?
|
(DG.DocContainer as DocumentContainer).Loaded += MainWindow_Loaded;
private void MainWindow_Loaded(object sender, RoutedEventArgs e) {
DocumentTabControl tab = VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) as DocumentTabControl;
tab.TabStripPlacement = Dock.Bottom;
} |
Hi Sudharsan,
Thank you for your help. That worked perfectly. The only thing is the label for the tab is now upside down. How would I change the orientation of the tab header text?
Thank you again for your help.
Mitch
Hi Sudharsan,
Sorry for the late response. I've just got around to looking into the issue I was having. I was able to solve the tab text orientation (thank you for your help).
The problem I am having now is the tab location reverting back to the default location (top) once all the document tabs have been closed and I then add a new document tab. Also, given the suggested approach, if there is not document in the DocumentTabControl when the TabStripPlacement property is set, no tab shows up at all. Here is the code I am using.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Syncfusion.Windows.Shared;
using Syncfusion.Windows.Tools.Controls;
namespace DockTabLocationExample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
{
ContentControl cc = new ContentControl();
DockingManager.SetDesiredWidthInDockedMode(cc, 150);
DockingManager.SetHeader(cc, "Pane One");
DockingManager.SetSideInDockedMode(cc, DockSide.Left);
DockingManager.SetState(cc, DockState.Dock);
Dock.Children.Add(cc);
// NewDocument_OnClick(this, new RoutedEventArgs());
}
private void Dock_OnLoaded(object sender, RoutedEventArgs e)
{
if (Dock.DocContainer is DocumentContainer dc)
{
dc.Loaded += DocumentContainer_Loaded;
dc.Unloaded += DocumentContainer_UnLoaded;
dc.Initialized += DcOnInitialized;
}
}
private void DcOnInitialized(object? sender, EventArgs e)
{
}
private void DocumentContainer_UnLoaded(object sender, RoutedEventArgs e)
{
}
private void DocumentContainer_Loaded(object sender, RoutedEventArgs e)
{
if (VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)
{
tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;
}
}
private void Dock_OnDockStateChanged(FrameworkElement sender, DockStateEventArgs e)
{
if (VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)
{
tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;
}
}
private void Dock_OnDockWindowStateChanged(FrameworkElement sender, DockWindowStateEventArgs e)
{
}
private void NewDocument_OnClick(object sender, RoutedEventArgs e)
{
ContentControl cc = new ContentControl();
DockingManager.SetHeader(cc, $"Document {count++}");
DockingManager.SetState(cc, DockState.Document);
Dock.Children.Add(cc);
if (VisualUtils.FindDescendant(Dock as Visual, typeof(DocumentTabControl)) is DocumentTabControl tabControl)
{
tabControl.TabStripPlacement = System.Windows.Controls.Dock.Bottom;
}
}
private int count = 1;
}
}
|
Recommended approach - exe will perform automatic configuration.
Please find the patch setup from below location:
Patch link : Please find the patch assemblies alone from below location:
Assemblies Link: NuGet link:
|
Installation Directions:
This patch should replace the files "Syncfusion.Tools.Wpf” under the following folder.
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]
E.g. : $system drive:\Program Files\Syncfusion\Essential Studio\19.4.0.48\precompiledassemblies\19.4.0.48\4.6
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location, or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.
https://www.syncfusion.com/support/directtrac/patches
Disclaimer:
Please
note that we have created this patch for version 19.4.0.48 specifically
to resolve the issue reported in this incident. If you have received other
patches for the same version for other products, please apply all patches in
the order received. Please let us know, if you are using any other
Syncfusion version, we will provide patch in your version.
Note: This Issue will be included in your upcoming NuGet and Main
Release.
Please let us know if you need any further assistance on this. We will be glad
to assist you.
Query 2: I am having now is the tab
location reverting to the default location (top) once all the document tabs
have been closed and I then add a new document tab.
We suggest using the event by replacing from below code snippet, As If we close all the items means, the tabcontrolext will get
disposed. New tabcontrolext will be created, if you add new document tab. For
that your event won't call since it is hooked in DocumentContainer loaded.
Please use the below one,
|
EventManager.RegisterClassHandler(typeof(DocumentTabControl),
LoadedEvent, new RoutedEventHandler(DocumentTabControl_Loaded), true); private
void DocumentTabControl_Loaded(object sender, RoutedEventArgs e) |
Please check the code snippet and let us know your concerns. We are happy to
assist you.
Regards,
Sudharsan