Programmatically show/hide a RadSplitContainer floating

1 Answer 21 Views
Docking
Deltaohm
Top achievements
Rank 2
Iron
Iron
Deltaohm asked on 30 Dec 2021, 09:22 AM | edited on 30 Dec 2021, 09:24 AM

Hi

I created a main window with RadDocking with DocumentHost and some RadSplitContainer.
Now with a user interaction I show a modeless window: I'd like to give the user the ability to dock this window in main window as docking part.
In the first look example of RadDocking there is a initial floating RadSplitContainer, but I would that my floating part only show after the user click a button and it was initially hidden.

Also, if I close the initially visible flaoting part, then I can't reopen it.

This is the flow of visibility:
1) Launch the application: floating window is not visible
2) Click on some button: floating window is now visible
3) User can dock the floating window on mainwindow docking

This is the RadDocking piece of xaml:

<t:RadDocking x:Name="radDocking1"
                            RetainPaneSizeMode="DockingAndFloating"
                            CanAutoHideAreaExceedScreen="True"
                            Grid.Row="1" Margin="0 0 0 10"                            
                            BorderThickness="0"
							CloseButtonPosition="InPane"
                            Padding="0"
						  PaneStateChange="radDocking1_PaneStateChange">
<t:RadDocking.DocumentHost>
<some code>
</t:RadDocking.DocumentHost>
<t:RadSplitContainer>
<some code>
</t:RadSplitContainer>
<t:RadSplitContainer>
<some code>
</t:RadSplitContainer>
<some code>
<t:RadSplitContainer>
</t:RadSplitContainer>
<t:RadSplitContainer Name="ImpulsiFloatContainer" 
						InitialPosition="FloatingDockable"
						 t:DockingPanel.InitialSize="900,1340"									 
						 Visibility="{Binding ImpulsiViewVisible, Converter={StaticResource BoolToVis}}">
					<t:RadPaneGroup >
						<t:RadPane  Header="{DynamicResource ResourceKey={x:Static r:ResourcesKeys.ImpulsiViewHeader}}">
							<local:ImpulsiViewControl />
						</t:RadPane>
					</t:RadPaneGroup>
				</t:RadSplitContainer>
			</t:RadDocking>

Thank you

Luigi

 

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 03 Jan 2022, 02:14 PM

Hello Luigi,

Generally, by setting the InitialPosition property to either FloatingOnly or FloatingDockable as a value, on an element, will initially host it inside a ToolWindow, which is a container that holds all elements that are in a floating state. With that said, to achieve the wanted result, you could subscribe to the ToolWindowCreated event of the RadDocking control. In it, the e.CreateElement property will be the newly created ToolWindow (ImpulsiFloatContainer RadSplitContainer) control. You could keep a reference to it inside the code-behind of the view, and via a button Click event, to change its Visibility property to Visible.

The following code snippets show the abovementioned logic's implementation:

<telerik:RadDocking ToolWindowCreated="RadDocking_ToolWindowCreated"/>
public partial class MainWindow : Window
{
    private ToolWindow impulsiFloatContainer;

    public MainWindow()
    {
        InitializeComponent();
    }

    private void RadButton_Click(object sender, RoutedEventArgs e)
    {
        this.impulsiFloatContainer.Visibility = Visibility.Visible;
    }

    private void RadDocking_ToolWindowCreated(object sender, Telerik.Windows.Controls.Docking.ElementCreatedEventArgs e)
    {
        this.impulsiFloatContainer = (ToolWindow)e.CreatedElement;
        this.impulsiFloatContainer.Visibility = Visibility.Collapsed;
    }
}

I have attached a sample project for you to test, so, could you give it a try?

Regards,
Stenly
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.

Tags
Docking
Asked by
Deltaohm
Top achievements
Rank 2
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or