Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1425
Showing ContentPane when its closed
posted

Hi,

I have a content page which I want to show based on a value being not null and I am using a converter for that.

Here is the code:

<igDock:SplitPane igDock:SplitPane.RelativeSize="100,100" SplitterOrientation="Vertical" >
                        <igDock:ContentPane TabHeader="ViewerContentPane"
                                        x:Name="MyPane"
                                        >
                            <igDock:ContentPane.Header>
                                <TextBlock>
                                <Run Text="Second Grid"/>
                                </TextBlock>
                            </igDock:ContentPane.Header>
                            <igDP:XamDataGrid BindToSampleData="True" FieldLayoutInitialized="XamDataGrid_FieldLayoutInitialized"/>
                        </igDock:ContentPane>
                        <igDock:ContentPane TabHeader="Viewer" AllowClose="True"
                                        x:Name="ViewerPane" MinWidth="200" AutomationProperties.AutomationId="MyViewerPane"
                                        Header="Viewer" >
                            <igDock:ContentPane.Style>
                                <Style>
                                    <Setter Property="igDock:ContentPane.Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=Tag, ElementName=MyViewer, Converter={StaticResource isNullConverter}}" Value="False">
                                            <Setter Property="igDock:ContentPane.Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </igDock:ContentPane.Style>
                            <ContentControl x:Name="MyViewer"></ContentControl>
                        </igDock:ContentPane>
                    </igDock:SplitPane>

here is the converter:

public class IsNullConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (value == null);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new InvalidOperationException("IsNullConverter can only be used OneWay.");
        }
    }

 

Will appreciate your help.

Thanks,

Imad.