Changing DockSate Programatically

4 posts, 0 answers
  1. Brian Henry
    Brian Henry avatar
    5 posts
    Member since:
    Dec 2009

    Posted 02 Jul 2010 Link to this post

    I am having trouble setting the DockState of a RadSplitContainer in code.

     

     

    <telerikDocking:RadDocking x:Name="docking" HasDocumentHost="False" Grid.Row="1">

     

     

     

        <telerikDocking:RadSplitContainer x:Name="dockSplit" Orientation="Vertical" InitialPosition="{Binding DispatchSettings.DispatchIniPos, Mode=TwoWay}">

     

     

     

    <telerikDocking:RadPaneGroup x:Name="groupPaneDispatch">

     

     

     

    <telerikDocking:RadPane x:Name="paneDispatch" CanUserClose="False" CanUserPin="False" PaneHeaderVisibility="Collapsed">

    When the user presses a button I want to toogle between DockedTop and DockedLeft as in the following button handler:

     

     

    private void btnXyz_Click(object sender, RoutedEventArgs e)

     

     

    {
        if (cond)
        {
            RadDocking.SetDockState(dockSplit, Telerik.Windows.Controls.Docking.DockState.DockedLeft);

     

     

     

        }
        else
        {
            RadDocking.SetDockState(dockSplit, Telerik.Windows.Controls.Docking.DockState.DockedTop);

     

        }
    }
    Unfortunately, this code does ot work unless I put it on the constructor.  How can I set the DockState programatically?

    Thank you,
    Brian

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Jul 2010 Link to this post

    Hi Brian,

     The InitialPosition property is used only for initially positioning the SplitContainer. If you want to set its placement after initialization you should use the RadDocking.DockState attached property.

    Hope this helps!

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Brian Henry
    Brian Henry avatar
    5 posts
    Member since:
    Dec 2009

    Posted 07 Jul 2010 Link to this post

    Could you please provide me with an example where you set the docstate programatically after the application has loaded.

    Thanks,
    Brian
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 12 Jul 2010 Link to this post

    Hi Brian Henry,

    Thank you for your reply.

    You can use the following code-snippet in order to work-around the issue:

    dockSplit.SetValue(RadDocking.DockStateProperty, Telerik.Windows.Controls.Docking.DockState.DockedTop);
    dockSplit.ClearValue(FrameworkElement.WidthProperty);
    dockSplit.ClearValue(FrameworkElement.HeightProperty);

    Hope this helps.

    If you have further questions please let us know.

    Sincerely yours,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top