Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to set different opacity for same image.For ex: I have one image so to left of it ,Opacity should be one and then decreasing Opacity from left to right of image,by right it should be Zero.
Posted

1 solution

An OpacityMask should do the trick:
XML
<Image Source="source-image.jpg">
    <Image.OpacityMask>
        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5" >
            <GradientStop Offset="0.0" Color="#00000000" />
            <GradientStop Offset="1.0" Color="#FF000000" />
        </LinearGradientBrush>
    </Image.OpacityMask>
</Image>

http://msdn.microsoft.com/en-us/library/ms743320%28v=vs.110%29.aspx[^]
 
Share this answer
 
v2
Comments
Madhuri Gamane 13-Sep-14 1:13am    
thanx for solution, it works...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900