Tabs now invalidated when dock text changed.

This commit is contained in:
Robin 2015-12-22 22:24:39 +00:00
parent 06e5d26801
commit 8a9e763fcf
3 changed files with 18 additions and 2 deletions

View File

@ -8,6 +8,12 @@ namespace DarkUI.Docking
[ToolboxItem(false)]
public class DarkDockContent : UserControl
{
#region Event Handler Region
public event EventHandler DockTextChanged;
#endregion
#region Field Region
private string _dockText;
@ -28,7 +34,8 @@ namespace DarkUI.Docking
_dockText = value;
// todo: trigger tabs to re-calculate in parent group
if (DockTextChanged != null)
DockTextChanged(this, null);
Invalidate();
}

View File

@ -68,6 +68,8 @@ namespace DarkUI.Docking
_contents.Add(dockContent);
Controls.Add(dockContent);
dockContent.DockTextChanged += DockContent_DockTextChanged;
_tabs.Add(dockContent, new DarkDockTab(dockContent));
if (VisibleContent == null)
@ -96,6 +98,8 @@ namespace DarkUI.Docking
_contents.Remove(dockContent);
Controls.Remove(dockContent);
dockContent.DockTextChanged -= DockContent_DockTextChanged;
if (_tabs.ContainsKey(dockContent))
_tabs.Remove(dockContent);
@ -514,6 +518,11 @@ namespace DarkUI.Docking
Invalidate();
}
private void DockContent_DockTextChanged(object sender, EventArgs e)
{
Invalidate();
}
#endregion
#region Render Region

View File

@ -213,7 +213,7 @@ namespace Example
DockPanel.AddContent(content);
}
}
private DarkDockContent GetContentBySerializationKey(string key)
{
foreach (var window in _toolWindows)