この奇妙なwpfの問題があります。画像付きのウィンドウ(フルスクリーンnm)があります。次のようになります。
このウィンドウの上にShowdialogを使用して新しいウィンドウを開きます。これはフルスクリーンではありません(ポップアップのように見えますが、ウィンドウです)。コードは次のようになります。
Window next; next = new PasswordVerification();
next.Owner = this;
next.ShowDialog();
開いているウィンドウで、これを使用して「ポップアップ」を中央に配置します。
this.Left = this.Owner.Left + (this.Owner.Width - this.ActualWidth) / 2;
this.Top = this.Owner.Top + (this.Owner.Height - this.ActualHeight) / 2;
this.Topmost = true;
私はこのようなものを手に入れます(私はそれをトリミングしました、ウィンドウは少し大きいです):
テキストブロックが次のように定義されている場合:
<Rectangle Name="errorBorder" Fill="#34FF0000" FlowDirection="RightToLeft" RadiusX="13" RadiusY="13" Stroke="#FFB80005" Visibility="Visible" Margin="43,195,78,203" />
<TextBlock Name="error" Text="TextBlock" Margin="49,195,91,205" FontSize="20" FlowDirection="RightToLeft" FontWeight="Bold" Foreground="#FFB80000" Visibility="Visible" />
今、私はこれを行うボタンを持っています:
error.Text = "blabla";
しかし、私が期待したもの(テキストが変更される)の代わりに、私はこの奇妙なものを手に入れました:
ご覧のとおり、私のtextBlockの代わりに、リアウィンドウからの画像がわずかに表示されています!
ここで何が起こっているのですか??助けてください!
ポップアップXAML:
<Window ... Width="1000" Height="700" AllowsTransparency="True"
WindowStyle="None"
Background="#00000000"/>
<Border Style="{StaticResource SmallScreenBorderStyle}" CornerRadius="23" Padding="2" Margin="153.66,117.992,153.661,117.992" d:LayoutOverrides="Width, Height">
<!-- Use a VisualBrush of 'mask' as the opacity mask -->
<Grid.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/>
</Grid.OpacityMask>
<!-- Rounded mask (stretches to fill Grid) to make grid rounded corners -->
<Border x:Name="mask" CornerRadius="20" Margin="2,5,-1,-5" d:LayoutOverrides="GridBox" Style="{StaticResource MaskBorderStyle}"/>