Dock Setting Floating Document Window Text

1 Answer 32 Views
Dock
Miles
Top achievements
Rank 1
Miles asked on 14 Jul 2024, 10:02 AM

Hi

 I’m using WinForms RadDock implementing a host and a bunch of DocumentWindow tabs.

The issue I’m having is setting the undocked floating window text so that the window shown in the Taskbar displays the text set, I'm getting the taskbar entry but it's always blank. I’ve tried a few approaches and none are successful. See code below.

private void MainDockHost_FloatingWindowCreated(object sender, FloatingWindowEventArgs e)
{
	//	first attempt
	e.Window.Text = "First Window";

	//	second attempt
	CustomFloatingWindow customWindow = new CustomFloatingWindow(MainDockHost);
	e.Window = customWindow;
	customWindow.Text = "Second Window";

	//	third attempt
	HostWindow hostWin1 = e.Window.Parent as HostWindow;

	if (hostWin1 != null)
	{
		hostWin1.Text = "Third Window";

		if (hostWin1.FloatingParent != null)
		{
			hostWin1.FloatingParent.Text = hostWin1.Text;
		}
	}

	//	forth attempt
	HostWindow hostWin2 = customWindow.Parent as HostWindow;

	if (hostWin2 != null)
	{
		hostWin2.Text = "Forth Window";

		if (hostWin2.FloatingParent != null)
		{
			hostWin2.FloatingParent.Text = hostWin2.Text;
		}
	}
}

As I’m using a document window I understand a floating window is created with the document window inside it. The two HostWindow attempts in the code both result in a null.

 

Any help with this would be appreciated.

Thanks

Miles


1 Answer, 1 is accepted

Sort by
1
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 17 Jul 2024, 08:26 AM

Hello, Miles,

Thank you for writing.

The text is updated dynamically, and you need to use the Shown event of the window to change it. Here is an example:

private void RadDock1_FloatingWindowCreated(object sender, FloatingWindowEventArgs e)
{
    e.Window.Shown -= Window_Shown;
    e.Window.Shown += Window_Shown;
}
private void Window_Shown(object sender, EventArgs e)
{
    FloatingWindow form = sender as FloatingWindow;
    form.Text = "MyFloatingWindowText";
}

I hope this will be useful. Please let me know if you have other questions.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Miles
Top achievements
Rank 1
commented on 17 Jul 2024, 12:48 PM

Hi Nadya

Many thanks that worked for me.

Much appreciated...

Tags
Dock
Asked by
Miles
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or