2

各測定の前後にユーザーコントロールで UpdateLayout を呼び出すことで解決できたようで、これまでのところうまく機能しています。誰かが別の解決策を持っている場合は、私に知らせてください

この 投稿にあるような問題があり、ユーザーがその背後にある理由を見つけたようです。スタック パネルを作成して、更新時にライブ タイルを適切にレンダリングする以外の解決策があるかどうか疑問に思っていました。同じコードは、タイルの作成時には問題なく機能しますが、更新時には適切にレンダリングされません。

これは私の方法です:

 private void updateFrontTile()
    {
        var frontTile = new FrontMzaarTileControl();

        TileData tileData = new TileData()
        {
            temp= "1",
            temp2= "2",
            temp3= "3",
            temp4= "4",
            temp5= "5"
        };

        frontTile.DataContext = tileData;
        frontTile.Measure(new Size(691, 336)); // the user from the other post believes that this is not doing anything
        frontTile.Arrange(new Rect(0, 0, 691, 336)); // the user from the other post believes that this is not doing anything


        var bmp = new WriteableBitmap(691, 336);
        bmp.Render(frontTile, null);
        bmp.Invalidate();

        var isf = IsolatedStorageFile.GetUserStoreForApplication();
        FrontTileFilename = "/Shared/ShellContent/FrontTile.jpg";

        if (!isf.DirectoryExists("/Shared/ShellContent"))
        {
            isf.CreateDirectory("/Shared/ShellContent");
        }

        using (var stream = isf.OpenFile(FrontTileFilename, System.IO.FileMode.Create))
        {
            bmp.SaveJpeg(stream, 691, 336, 0, 100);
        } 
    }
4

0 に答える 0