close and show RadDocking programmatically

2 posts, 0 answers
  1. Allel
    Allel avatar
    1 posts
    Member since:
    Sep 2012

    Posted 28 Jan 2014 Link to this post


    I have two buttons one to show and other to close my RadDoking. By default, the RadDoking is deactivated(not show), when I press the show button, the RadDoking opens but on I prese my close button it does not work

    My Xaml :

    <telerik:RadDocking Grid.Column="1"     x:Name="radDocking1"  Grid.Row="1" Margin="0 0 0 10" BorderThickness="0"   
                      Visibility="{Binding Hidden,ConverterParameter=True, Mode=TwoWay,  Converter={StaticResouce                                    CvtVisibilityConverter}}"
                      Padding="0" >
                 
                <telerik:RadSplitContainer InitialPosition="FloatingOnly" 
                        telerik:RadDocking.FloatingLocation="450, 250" >
                    <telerik:RadPaneGroup >
                        <telerik:RadPane          Title="My Pane"
                                                  CanDockInDocumentHost="False"
                                                  CanUserClose="False" CanUserPin="False" >
                            
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
     </telerik:RadDocking>

    My ViewModel

    public class MyViewModel: ViewModelBase
    {
     
    public MyViewModel
    {
        Hidden = true ;
    }
     
     
    public bool Hidden
            {
                get
                {
                    return hidden;
                }
                set
                {
                     
                        hidden = value;
                        OnPropertyChanged("Hidden");
                     
                }
            }
     
            private ICommand showCommand;
            private ICommand closeCommand;
     
            public ICommand CloseCommand
            {
                get
                {
                    if (closeCommand == null)
                        closeCommand = new RelayCommand(param => this.CloseCommandEvent());
                    return closeCommand;
                }
            }
     
     
            private void CloseCommandEvent()
            {
                Hidden = true;
            }
     
     
            public ICommand showCommand
            {
                get
                {
                    if (showCommand == null)
                        showCommand = new RelayCommand(param => this.ShowCommandEvent());
                    return showCommand;
                }
            }
     
            private void ShowCommandEvent()
            {
                Hidden = false;
          
            }
    }

    My Converter 
    public class VisibilityConverter : IValueConverter
       {
           public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
           {
               if (value == null || !(value is Boolean))
                   return Visibility.Collapsed;
     
               var parm = parameter ?? false;
               bool flip;
               Boolean.TryParse(parm.ToString(), out flip);
               var visible = flip ? !((bool)value) : (bool)value;
               return visible ? Visibility.Visible : Visibility.Collapsed;
                
     
     
     
           }
     
           public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
           {
               throw new NotImplementedException();
           }
       }

    I do not understand why it does not work, Thank you for your help :) 
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 31 Jan 2014 Link to this post

    Hi Allel,

    I was not able to reproduce the described issue on our side. I recreated the scenario in a sample project and the Docking was behaving as expected. I am attaching the project here so you can check it, however please note that the Floating Pane is not supposed to hide with Docking as it is located in another visual tree.

    Hope the attached project will help you to achieve the required.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top