Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SplitView Pane not shown #3533

Closed
void22 opened this issue Jun 14, 2019 · 1 comment
Closed

SplitView Pane not shown #3533

void22 opened this issue Jun 14, 2019 · 1 comment
Labels
Milestone

Comments

@void22
Copy link

void22 commented Jun 14, 2019

Describe the bug
When SplitView initialized with _split.Visibility=Visibility.Collapsed then later changed to _split.Visibility=Visibility.Visible Pane does not appear.

To Reproduce

MainWindow.xaml

<controls:MetroWindow x:Class="guitest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:local="clr-namespace:guitest"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    
    <Grid>
        <StackPanel x:Name="_stack">
            <Button Content="to SpliView" Width="95" Height="35" Click="Button_Click" />
        </StackPanel>
        <controls:SplitView x:Name="_split" Background="Green" DisplayMode="Inline" CompactPaneLength="60" OpenPaneLength="250" PaneBackground="Red" IsPaneOpen="True">
            <Button Content="to TabControl" Width="95" Height="35" Click="Button_Click_1" />
        </controls:SplitView>
    </Grid>
</controls:MetroWindow>

MainWindow.xaml.cs

public partial class MainWindow : MetroWindow
{
    public MainWindow()
    {
        InitializeComponent();

        _split.Visibility = Visibility.Collapsed;
        _stack.Visibility = Visibility.Visible;
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        _split.Visibility = Visibility.Visible;
        _stack.Visibility = Visibility.Collapsed;
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        _split.Visibility = Visibility.Collapsed;
        _stack.Visibility = Visibility.Visible;
    }
}

If the SplitView set to visible first, everything is working as expected.

public MainWindow()
{
    InitializeComponent();

    _split.Visibility = Visibility.Visible;
    _stack.Visibility = Visibility.Collapsed;
}

Expected behavior
SplitView.Pane displayed with size specified in OpenPaneLength.

Screenshots
Expected output:
image

Wrong output:
image

Environment:

  • MahApps.Metro v1.6.5 from NuGet
  • OS: Win10 1903
  • Visual Studio 2017 15.9.13
  • .NET Framework 4.7.1

Additional context
2.0.0-alpha0391 (from NuGet) also not working properly. Maybe Windows 1903 update causes the problem.

@punker76 punker76 added the Bug label Jun 14, 2019
@punker76 punker76 added this to the 2.0.0 milestone Jun 14, 2019
punker76 added a commit that referenced this issue Jun 14, 2019
When a SplitView was initialized with Visibility=Visibility.Collapsed then the Pane does not appear when changing to Visibility=Visibility.Visible.

If the SplitView starts invisible then the inner template part PaneClipRectangle is not available at the loaded event and changing the visual state has no effect.

To fix this the loaded event with the visual state change must be called when the template will be applied. If the SplitView is already loaded then this can be called directly.
@punker76
Copy link
Member

@void22 this has now been fixed, and it will be released in the next version of MahApps.Metro v2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants