2012-03-28 2 views
0

이 wierd wpf 문제가 있습니다. 나는 이미지와 창 (전체 screennm)가은 다음과 같습니다 enter image description here창이 showDialog와 함께 열렸으며 TextBlock이 텍스트 대신 창 아래에 표시됩니다.

내가 전체 화면으로하지 않습니다이 창, uppon 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; 

나는 이런 식으로 뭔가를 얻을 수 (나는 그것을 자른, 윈도우가 약간 있습니다 더 큰) : TextBlock의는 다음과 같이 정의된다 enter image description here

:

  <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"; 

하지만 그 대신 내가 (텍스트가 변경됩니다) 나는이 이상한 물건을 얻을 것으로 예상 무엇 : enter image description here 당신이 볼 수 있듯이, 후면에서 이미지를지금 나는 버튼이, 그이 수행 내 textBlock 대신 창을 sligtly 표시됩니다!

여기에 무슨 일이 일어나고 있습니까? 도와주세요!

팝업 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}"/> 
+0

동작을 재현하려는 간단한 앱을 만들었지 만 예상대로 작동했습니다. 사진에서 볼 때 나는 PasswordVerification 창에 팝업과 같이 보이도록 수정했다고 가정합니다. 그걸 보여줄 수 있니? 또는 문제를 좁히기 위해 스위치를 끄십시오. – SvenG

+0

예. 내 게시물을 편집, 일부 xaml을 추가합니다 – Programer

답변

0

몇 가지 제안 :
1) 당신의 Window XAML에서 이것을 사용, 소유자의 중심에 창을 엽니 코드를 제거

<Window .... 
    WindowStartupLocation="CenterOwner"> 

2) 전화 걸기 방법을 줄이십시오 :

Window next = new PasswordVerification {Owner = this}; 
next.ShowDialog(); 

3) y 우리 RectangleTextBlock<StackPanel> 또는 다른 컨테이너에 넣습니다. 아마도 Grid 내에서의 삶이기 때문에 이러한 컨트롤이 겹치는 문제 일 것입니다.

+0

1 코드가 누락되었습니다. 2는 코드가 좀 더 길기 때문에 까다로워하지 않습니다. 여기서는 편의를 위해 단순화했습니다. 나는 시도 할 것이다 – Programer

+0

나는 포스트를 고쳤다 :) – asktomsk

+0

3는 내가 서로를 필요로하기 때문에 좋지 않다. – Programer

0

기본 양식에서 Visible 속성을 false로 설정하고 ShowDialog 후에 true로 설정해 볼 수 있습니까?

관련 문제