C# ASP.NET WPF-带角半径的图像溢出边框
我在ASP.NET WPF项目中遇到了一个问题,边界内的图像超出了边界限制。请遵循以下我的代码:C# ASP.NET WPF-带角半径的图像溢出边框,c#,asp.net,wpf,image,cornerradius,C#,Asp.net,Wpf,Image,Cornerradius,我在ASP.NET WPF项目中遇到了一个问题,边界内的图像超出了边界限制。请遵循以下我的代码: <Border CornerRadius="20" Grid.Column="0" Grid.Row="0" > <Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"> <Image Source="{
<Border CornerRadius="20" Grid.Column="0" Grid.Row="0" >
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
<Image Source="{Binding ImagePath}" />
</Button>
</Border>
事实上,我找到了一种解决方法,它与以前不同,而且比以前更简单 以下是我的解决方案:
<Border CornerRadius="20" Grid.Column="0" Grid.Row="0">
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
</Button>
<Border.Background>
<ImageBrush ImageSource="{Binding UploadImage}"/>
</Border.Background>
</Border>
这是否回答了您的问题@安迪:这个答案不准确,不过还是要谢谢你。我找到了另一个解决办法