This is a migrated thread and some comments may be shown as answers.

close and show RadDocking programmatically

1 Answer 156 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Allel
Top achievements
Rank 1
Allel asked on 28 Jan 2014, 11:50 AM

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 :) 

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 31 Jan 2014, 11:12 AM
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 >>
Tags
Docking
Asked by
Allel
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or