The VisualBrush only refresh the visual but not the layout when the Visual visibility changes
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.0 Preview6
* Windows version: Windows 10.0.18932.1000
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
**Problem description:**
1. We have a `Border` to show a `VisualBrush` of another `Grid`
1. The `Grid` contains a `Rectangle` and a `TextBlock` and the `Rectangle` will change its visibility period.

**Actual behavior:**
The `Border` `VisualBrush` will not refresh its layout.

But if we set the initial visibility of the `Rectangle` to `Collapsed`, we'll find that the initial `VisualBrush` shows the correct state.

**Expected behavior:**
The `VisualBrush` will refresh the layout.
**Minimal repro:**
This is the whole XAML file:
```xml
```
This is the code-behind. Notice that it changes the visibility of the `Rectangle` every 1 second.
```csharp
using System.Threading.Tasks;
using System.Windows;
namespace Walterlv.Demo
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Loaded += OnLoaded;
}
private async void OnLoaded(object sender, RoutedEventArgs e)
{
while (true)
{
await Task.Delay(1000);
VisibleOr.Visibility = Visibility.Collapsed;
await Task.Delay(1000);
VisibleOr.Visibility = Visibility.Visible;
}
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.