2012-05-16 5 views
0

나는 하이퍼 링크 버튼 안에 이미지를로드하는 Windows Phone 7 앱을 사용하고 있습니다. 이것은 완벽하게 사각형이 아닐 때 이미지 주위에 공백을 넣는 것을 제외하고는 Stretch="Uniform"을 제외하고는 훌륭하게 작동합니다. 이것을 투명하게 만드는 방법이 있습니까? WP7/WPF 공백 주위의 공백 = "유니폼"

White space around image

<HyperlinkButton NavigateUri="{Binding Id, StringFormat='{}/x;component/Pages/FullScreenImage.xaml?id={0}'}" 
        Grid.Column="0" Grid.Row="0" 
        toolkit:TiltEffect.IsTiltEnabled="True" Background="Transparent"> 
    <HyperlinkButton.Template> 
     <ControlTemplate TargetType="HyperlinkButton"> 
      <Grid Margin="0,0,0,10" > 
       <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="*" /> 
       </Grid.ColumnDefinitions> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="Auto" /> 
        <RowDefinition Height="*" /> 
       </Grid.RowDefinitions> 

       <TextBlock Grid.Column="0" 
        Grid.Row="0" 
        Text="Advertised" 
        Margin="10,0,0,0" 
        Style="{StaticResource PhoneTextSubtleStyle}" /> 
       <Image Grid.Column="0" 
        Grid.Row="1" 
        Margin="0" 
        Stretch="Uniform" 
        Source="{Binding ExpectedImage}" /> 
      </Grid> 
     </ControlTemplate> 
    </HyperlinkButton.Template> 
</HyperlinkButton> 

답변

0

내 이미지 소스는 흰색을 만드는 것입니다. :/

+0

언제나 그렇습니까? 당신은 WritableBitmap에 그것을로드하여자를 수 있습니다 - 또는 심지어 당신이 찾고있는 것을 얻기 위해 픽셀 탐지와 BFS 알고리즘을 사용할 수 있습니다. (쓰기가 가능한 Bitmap에서 말하자면, 3 개의 흰색이 아닌 이웃을 가지고있는 모양을 검색). 그것은 당신이 그것을 어떻게 사용하고 있는지 그리고 그것이 가능한 성능 문제에 가치가 있는지 여부에 달려 있습니다. 또한 앱을 '강하게 테마'로 만들 수 있으며 더 이상 검은 배경을 지원하지 않을 수 있습니다. –

+0

정보 주셔서 감사합니다! 이미지 소스를 제어 할 수 있다는 것을 알게되었으므로 되돌아 오는 이미지의 자르기 스타일을 변경할 수 있습니다. –