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

Show/Hide RadPane

5 Answers 976 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Yvonne
Top achievements
Rank 1
Yvonne asked on 16 Feb 2011, 12:16 PM
Hy all,

I tried to bind the IsPinned and the Visiblity property of the RadPane. When a user logs-in IsPinned shall be set to true and Visibility is set to Visible. On the other hand on logout IsPinned=false and Visibility=Hidden.

Unfortunately on login the Pane is not pinned?
Is there an other way to implement this?

I'm using the latest oficial release.

5 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 21 Feb 2011, 08:53 AM
Hello Yvonne,

We could not reproduce this behavior. Attached is a very basic sample, showing the proper functioning of the Pin/Unpin feature.

Please, share in details how we can reproduce the issue or send a working sample which reproduces it.

Regards,
Dani
the Telerik team
0
Yvonne
Top achievements
Rank 1
answered on 01 Mar 2011, 07:41 PM
Hy,
Following is an abstract of my code:

/*SplitterTest.xaml
-----------------*/
<Window x:Class="WpfApplication1.SplitterTest"
        xmlns:local="clr-namespace:WpfApplication1" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking" Title="SplitterTest" Height="300" Width="300">
  
  <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
  
    <telerik:RadDocking Grid.Column="0" Grid.Row="1">
  
      <!--Module area pane-->
      <telerik:RadDocking.DocumentHost>
        <StackPanel Grid.Column="0" Grid.Row="0" >
          <Button Content="Toggle Show Bottom Pane" Margin="3" Click="OnToggleShowBottomPaneClicked"/>
          <TextBlock Grid.Column="0" Grid.Row="1" Text="Top Pane" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightYellow"/>
        </StackPanel>
      </telerik:RadDocking.DocumentHost>
  
      <!--Message pane-->
      <telerik:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedBottom" Visibility="{Binding ShowBottomPane, Converter={local:BoolToVisibilityConverter}}">
        <telerik:RadPaneGroup>
          <telerik:RadPane Header="Bottom"
                           CanFloat="False" CanUserClose="False"
                           ContextMenuTemplate="{x:Null}"
                           IsPinned="{Binding ShowBottomPane}"
                           Visibility="{Binding ShowBottomPane, Converter={local:BoolToVisibilityConverter}}">
            <TextBlock Grid.Column="0" Grid.Row="3" Text="Bottom Pane" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightBlue" />
          </telerik:RadPane>
        </telerik:RadPaneGroup>
      </telerik:RadSplitContainer>
    </telerik:RadDocking>
  
  </Grid>
  
</Window>

 

/*SplitterTest.xaml.cs
--------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
  
namespace WpfApplication1
{
  /// <summary>
  /// Interaction logic for SplitterTest.xaml
  /// </summary>
  public partial class SplitterTest : Window
  {
    public SplitterTest()
    {
      InitializeComponent();
  
      ViewModel = new SplitterTestViewModel();
    }
  
    public SplitterTestViewModel ViewModel
    {
      get { return DataContext as SplitterTestViewModel; }
      set { DataContext = value; }
    }
  
    private void OnToggleShowBottomPaneClicked(object sender, RoutedEventArgs e)
    {
      ViewModel.ShowBottomPane = !ViewModel.ShowBottomPane;
    }
  
  }
}
  
  
  
  
/*SplitterTestViewModel.cs
------------------------*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
  
namespace WpfApplication1
{
  public class SplitterTestViewModel : INotifyPropertyChanged
  {
    private bool _showBottomPane;
  
    public SplitterTestViewModel()
    {
      ShowBottomPane = true;
    }
  
    public bool ShowBottomPane
    {
      get { return _showBottomPane; }
      set 
      {
        if (_showBottomPane != value)
        {
          _showBottomPane = value;
          RaisePropertyChanged("ShowBottomPane");
          RaisePropertyChanged("ShowBottomPaneInverted");
        }
      }
    }
  
    public bool ShowBottomPaneInverted
    {
      get { return !_showBottomPane; }
    }
  
    #region INotifyPropertyChanged Members
  
    public event PropertyChangedEventHandler PropertyChanged;
  
    private void RaisePropertyChanged(string propertyName)
    {
      if (PropertyChanged != null)
      {
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
    }
  
    #endregion
  }
}
0
Dani
Telerik team
answered on 07 Mar 2011, 09:42 AM
Hi Yvonne,

Thank you for the supplied sources.

If I understand your goal correctly, you wish the default value for the IsPinned property to be true. I tested your code and it does provide the desired result - initially the bottom pane is Pinned. Please, explain in more details what should be the behavior from the provided code.

Kind regards,
Dani
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Yvonne
Top achievements
Rank 1
answered on 17 Mar 2011, 02:05 PM
Hy Dani,

Initially the pane is pinned. What I want to do is that when the button is clicked the  pane should unpin and after clicking the button a second time the pane should pin again.

Regards,
Yvonne
0
Dani
Telerik team
answered on 22 Mar 2011, 09:56 AM
Hello Yvonne,

I suggest that you use TwoWay bindings, otherwise bindings get lost on some point.

<telerik:RadPane Header="Bottom"
                           CanFloat="False" CanUserClose="False"
                           ContextMenuTemplate="{x:Null}"
                           IsPinned="{Binding ShowBottomPane, Mode=TwoWay}"
                           Visibility="{Binding ShowBottomPane, Converter={local:BoolToVisibilityConverter}}" /> 

Also, it makes sense to use a toggle button instead of a button for the task:

<ToggleButton Content="Toggle Show Bottom Pane" Margin="3" IsChecked="{Binding ShowBottomPane, Mode=TwoWay}" />

I hope this helps.

Greetings,
Dani
the Telerik team
Tags
Docking
Asked by
Yvonne
Top achievements
Rank 1
Answers by
Dani
Telerik team
Yvonne
Top achievements
Rank 1
Share this question
or