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

When I set RadPane.IsHidden to 'false' after it has been set to 'true' the RadPain remains invisible.

3 Answers 74 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 15 Aug 2016, 06:35 AM
Hello. When I set RadPane.IsHidden to 'false' after it has been set to 'true' the RadPain remains invisible. Below is XAML markup:
<UserControl x:Class="DeviceReading.Views.DeviceReadingView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             prism:ViewModelLocator.AutoWireViewModel="True">
 
. . . . . . . . . . . . . . . . . . .
<StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0 5 0 3" Orientation="Horizontal">
   <CheckBox Content="Gas Velocity" Command="{Binding Path=ShowHideGasVelocityChartViewCommand}" CommandParameter="{Binding Path=IsChecked, RelativeSource={RelativeSource Self}}"/>
</StackPanel>
<telerik:RadDocking Grid.Row="1" Grid.Column="0" x:Name="Docking">
. . . . . . . . . . . . . . . . . . .
   <telerik:RadSplitContainer>
      <telerik:RadPaneGroup>
         <telerik:RadPane Header="Gas Velocity" IsHidden="{Binding IsGasVelocityChartHidden, Mode=TwoWay}" prism:RegionManager.RegionName="GasVelocityChartRegion" />
      </telerik:RadPaneGroup>
   </telerik:RadSplitContainer>
. . . . . . . . . . . . . . . . . . .
</telerik:RadDocking>
. . . . . . . . . . . . . . . . . . .
 
</UserControl>

Where UserControl is Prism UserControl. Below is ViewModel code.

public class DeviceReadingViewModel : BindableBase, IConfirmNavigationRequest
{
   . . . . . . . . . .
   public DeviceReadingViewModel(IEventAggregator eventAggregator)
   {
     this._eventAggregator = eventAggregator;
     this.ShowHideGasVelocityChartViewCommand = new DelegateCommand<object>(this.showHideGasVelocityChartView);
   }
 
   // Field and property controlling of the RadPain status (Visible / Hidden)
   private bool _isGasVelocityChartHidden;
   public bool IsGasVelocityChartHidden
   {
      get { return this._isGasVelocityChartHidden; }
      set { this.SetProperty(ref this._isGasVelocityChartHidden, value); }
   }
 
   // The command of hidding / visualizing of the RadPain.
   public DelegateCommand<object> ShowHideGasVelocityChartViewCommand { get; private set; }
 
   private void showHideGasVelocityChartView(object parameter)
   {
      if ((bool)parameter == true)
        this.IsGasVelocityChartHidden = false;
      else
        this.IsGasVelocityChartHidden = true;
   }
}

Initially (after application loading) the RadPain is visible and the CheckBox is unchecked. When I check the CheckBox first then the RadPain become invisible. But when I uncheck the CheckBox after it then the RadPain remains invisible (but the command is fired). How to have the command display the RadPain each time the CheckBox is unchecked? What I'm doing wrong?

3 Answers, 1 is accepted

Sort by
0
Dmitry
Top achievements
Rank 1
answered on 15 Aug 2016, 06:43 AM

I bag your pardon. In command method I have:

private void showHideGasVelocityChartView(object parameter)
{
   if ((bool)parameter == true)
     this.IsGasVelocityChartHidden = true;
   else
     this.IsGasVelocityChartHidden = false;
}

But the problem remains. The RadPain is not visualized after the CheckBox has been unchecked. Please help.

0
Accepted
Nasko
Telerik team
answered on 15 Aug 2016, 09:40 AM
Hi Yaroslav,

When the IsHidden gets set to True the Panes that are bound gets removed from the visual tree. Because of that when the IsHidden is set to False the binding no longer is working as expected and the Panes could not be visualized. In order the bindings to be preserved and everything to work as expected the DataContext of the Panes should be set with the DataContext of its parent as shown below:
<telerik:RadPane DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadDocking}}, Path=DataContext}"  Header="ViewB"
regions:RegionManager.RegionName="ModuleB" IsHidden="{Binding IsHidden, Mode=TwoWay}"/>

Please, give it a try.

Hope this helps.

Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dmitry
Top achievements
Rank 1
answered on 15 Aug 2016, 01:17 PM
Hello, Nasco. Thank you very much for your help. Now 'RadPain.IsHidden' property works as I need. Thank you.
Tags
Docking
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Dmitry
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or