2014-04-07 2 views
0

내 앱에서 사진을 찍으려면 다음 코드를 사용하지만 사진을 받으면 이미지가 늘어나지 만 그 페이지에서 멀어지면 다시 이미지 해상도가 올바르지 만 이미지가 검은 색입니다. 내 질문에 어떻게 스트레칭없이 이미지를 올바르게 표시 할 수 있습니다.CameraCaptureTask에서 사진의 크기를 올바르게 조정하는 방법은 무엇입니까?

CameraCaptureTask cam = new CameraCaptureTask(); 
     cam.Completed += task_Completed; 

     cam.Show(); 



    void task_Completed(object sender, PhotoResult e) 
    { 
     if (e.TaskResult == TaskResult.OK) 
     { 
      System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage(); 
      bmp.SetSource(e.ChosenPhoto); 
      imgProfilePic.ImageSource = bmp; 
} 

와 XAML은 다음과 같습니다

에서
<Button HorizontalAlignment="Center" 
         toolkit:TurnstileFeatherEffect.FeatheringIndex="2" 
         toolkit:TiltEffect.IsTiltEnabled="True" 
         x:Name="btnprofilepic" 
         Width="250" 
         HorizontalContentAlignment="Center" 
         VerticalContentAlignment="Center" 
         MouseLeave="btnprofilepic_MouseLeave" 
         Tap="imgProfilePic_Tap" 
         Margin="0,20,0,20" 
         Height="200"       BorderThickness="0" 
         MouseLeftButtonUp="btnprofilepic_MouseLeftButtonUp" 
         MouseLeftButtonDown="btnprofilepic_MouseLeftButtonDown"> 
        <Button.Background> 
         <ImageBrush x:Name="imgProfilePic" 
           Stretch="Fill" /> 
        </Button.Background> 
       </Button> 

답변

1

당신의 XAML 메이크업 스트레치 채우기가 컨테이너에 따라 이미지를 스트레치 때문에 ...

= "통일"