locked
BitmapEffect RRS feed

  • Question

  • I'm trying to get the proprety of Border.BitmapEffect of WPF with windows phone but i still can't find a solution for this problem to create the shadow reflet of a picture

    does anyone has an idea to share it ?

    Thanks :)


    zipo
    Thursday, October 13, 2011 1:48 PM

Answers

  • Effects don't exist in a built in form in WP. You can achieve most similar tasks using WriteableBitmap, which can take a UIElement as a source element. Here is a simple example of taking a Button and putting its visual into an Image, you can then make the image look like a reflection with mirroring and opacity masks that fade it.

    <Button x:Name="Button" Content="Button" Height="87" Margin="119,90,217,0" VerticalAlignment="Top"/>
                <Image x:Name="Image" Margin="110,174,204,0" RenderTransformOrigin="0.5,0.5" Height="82" VerticalAlignment="Top" >
                	<Image.Projection>
                		<PlaneProjection GlobalOffsetX="69"/>
                	</Image.Projection>
                	<Image.RenderTransform>
                		<CompositeTransform ScaleY="-1"/>
                	</Image.RenderTransform>
                </Image>
    

     public partial class MainPage : PhoneApplicationPage
        {
            public MainPage()
            {
                InitializeComponent();
                this.Loaded += new RoutedEventHandler(MainPage_Loaded);
                
    
            }
    
            void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                var wb = new WriteableBitmap(this.Button, null);
                this.Image.Source = wb;
            }
        }
    


    • Marked as answer by Zied Nassr Sunday, October 16, 2011 12:05 PM
    Thursday, October 13, 2011 3:12 PM
    Moderator