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

IsHidden Problem in RadPane with binding

8 Answers 338 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 16 Apr 2013, 11:05 AM
Hi There,

I have a problem with RadPanes isHidden property, i want to set IsHidden by using a binding, but when i do this it is not working, but if i set the IsHidden="True" at XAML then its working properly, can you please guide me in this case ?

Thanks in advance,
Srinivas.

8 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 18 Apr 2013, 06:29 AM
Hi Srinivas,

When a RadPane is hidden it is moved out of the visual tree so its DataContext is set to null. When the DataContext is set to null the IsHidden binding is lost and you cannot show it again. However if you explicitly set the DataContext of the RadPane it will not be lost and everything will work as expected. here is sample code:

XAML
<Window.Resources>
    <local:ViewModel x:Key="ViewModel" />
</Window.Resources>
 
<Grid DataContext="{Binding Source={StaticResource ViewModel}}">
    <Grid.RowDefinitions>
        <RowDefinition Height="22" />
        <RowDefinition />
    </Grid.RowDefinitions>
     
    <CheckBox Content="Is Hidden" IsChecked="{Binding IsHidden, Mode=TwoWay}" />
     
    <telerik:RadDocking Grid.Row="1">
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="Pane 1" DataContext="{StaticResource ViewModel}" IsHidden="{Binding IsHidden, Mode=TwoWay}" />
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking>
</Grid>

Greetings,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Robert
Top achievements
Rank 1
answered on 18 Oct 2013, 11:23 AM
Well this answers why I am unable to locate my pane using the following method when the IsHidden property is set.

CustomerOrderDetailsPane customerOrderDetailsPane = this.FindChildByType<CustomerOrderDetailsPane>();


Can you recommend a way to hide a pane but still allow it to be searchable?

Would collapsing the visibility setting work better?

Many thanks,

Rob
0
George
Telerik team
answered on 22 Oct 2013, 07:40 AM
Hello Rob,

You could set the x:Name of the Pane and use it in the code-behind as well. Hope this helps.


Regards,
George
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 >>
0
John
Top achievements
Rank 1
Iron
answered on 26 Oct 2016, 01:49 PM
Only direct binding works? Because the setter in the style(<Setter Property="IsHidden" Value="True" />) is not being applied:
<t:RadPane HorizontalAlignment="Left" CanUserClose="False" Title="Gates" DataContext="{Binding Active, Source={gui:SubApplicationSelectorRetreiver}}"
           DataContextChanged="RadPane_DataContextChanged">
    <t:RadPane.Style>
        <Style TargetType="t:RadPane" BasedOn="{StaticResource MyPaneStyle}">
            <Setter Property="IsHidden" Value="True" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Converter={StaticResource typeof}}" Value="{x:Type local:MDVDesignerAdapter}">
                    <Setter Property="IsHidden" Value="False" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </t:RadPane.Style>
    <t:RadPane.ContentTemplate>
        <DataTemplate>
            <local:MDVToolbox />
        </DataTemplate>
    </t:RadPane.ContentTemplate>
</t:RadPane>
0
Nasko
Telerik team
answered on 28 Oct 2016, 12:14 PM
Hello John,

The observed by you behavior is an expected one when DataTriggers are used. When the Pane is visualized (IsHidden is True) the property takes precedence over the the DataTrigger - you could no longer change its value through the Trigger.

We suggest you to consider using direct binding for the IsHidden property instead of using Triggers to change its value.

Hope the provided information will be helpful for you.

Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
AEDT developer
Top achievements
Rank 1
answered on 20 Apr 2017, 01:16 PM
Hi, setting the DataContext of the RadPane doesn't seem to work on the current version of the Telerik RadPane. Any other suggestion instead of using the code-behind and the x:Name to access the property.
0
Nasko
Telerik team
answered on 21 Apr 2017, 08:33 AM
Hello Andrea,

The proposed by Ivo approach with setting of the DataContext should be working as expected. Please, check the attached sample that demonstrates how setting of the DataContext for the RadPane is working on our side.

We hope that the sample will be helpful for you.

Regards,
Nasko
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
AEDT developer
Top achievements
Rank 1
answered on 21 Apr 2017, 11:14 AM
thank you! this works!
Tags
Docking
Asked by
Ravi
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Robert
Top achievements
Rank 1
George
Telerik team
John
Top achievements
Rank 1
Iron
Nasko
Telerik team
AEDT developer
Top achievements
Rank 1
Share this question
or