locked
image not appearing on secondary tile RRS feed

  • Question

  • Hi i'm trying to resize an image to show it in a secondary tile.My code works fine  but i don't know what i'm doing wrong because when the image is bigger than 1000*1000   the image is not shown in the secondary tile this is my code  that i use to resize

    //restablecemos el nuevo tamañao 100*100
                using (var sourceStream = await file.OpenAsync(FileAccessMode.Read))
                {
                    BitmapDecoder decoder = await BitmapDecoder.CreateAsync(sourceStream);
                    BitmapTransform transform = new BitmapTransform() { ScaledHeight =100, ScaledWidth= 100 };
                    PixelDataProvider pixelData = await decoder.GetPixelDataAsync(
                    BitmapPixelFormat.Rgba8,
                    BitmapAlphaMode.Straight,
                    transform,
                    ExifOrientationMode.RespectExifOrientation,
                    ColorManagementMode.DoNotColorManage);
    
                    using (var destinationStream = await localfile.OpenAsync(FileAccessMode.ReadWrite))
                    {
                        BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, destinationStream);
                        encoder.SetPixelData(BitmapPixelFormat.Rgba8, BitmapAlphaMode.Premultiplied, 100,100,96, 96, pixelData.DetachPixelData());
                        await encoder.FlushAsync();
                    }
                }

    and this is my code that i use to pin and show the secondary tile

    private async void btnpin(object sender, RoutedEventArgs e)
        {
    
            //mantenmos abierta el appbar
            this.miappbar.IsSticky = true;
    
            //obtenemos la imagen del .json y la mostramos en  la nota
            Uri smalllogo = new Uri(pequeniaImagen);
    
            //creamos el secondary tile
            SecondaryTile secondary = new SecondaryTile(logoSecondaryTileld, String.Format("{0} {1:d}",pageTitle.Text,Convert.ToDateTime(tvFecha.Text)),pageTitle.Text,logoSecondaryTileld, TileOptions.ShowNameOnLogo,smalllogo);
            secondary.DisplayName =pageTitle.Text;//nombre de la nota
            //obtenemos el color de fondo del secondary tile
            SolidColorBrush brush= Editor.returnColorfromString(Mcolor);
            secondary.BackgroundColor = brush.Color;
            //color del texto
            secondary.ForegroundText = ForegroundText.Dark;
    
    
            bool isPinned = await secondary.RequestCreateForSelectionAsync(detalles.GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Below);
            //el usuario pinieo la nota
            if (isPinned)
            {
                //ocultamos el btn pin
                btnpin.Visibility = Visibility.Collapsed;
                //mostramos el btn unpin
                btnunpin.Visibility = Visibility.Visible;
                this.firstbord.Visibility = Visibility.Collapsed;
    
            }
    
            this.miappbar.IsSticky = false;
    
        }           

    does anybody knows the reason of this error?  

    i hope you can help me

    thanks.


    Blog Saludos desde México DF

    Wednesday, June 5, 2013 5:51 AM

Answers

  • Hi,

    Below link will be useful for you:-

    1) Link1

    2) Link2


    Happy Coding!! If my post answers your question please 'Mark as Answer' and 'Vote as Helpful' if it helps you.

    Wednesday, June 5, 2013 10:46 AM