c# - Tiling image in a Grid -


how can tile single image (small size) multiple times in grid container appears grid holding 1 single image instead of multiple images tiled together?

i've seen methods create single image copying smaller image multiple times blitting, process computationally expensive. don't want create bigger image; want use same single image multiple times process doesn't require cpu cycles.

how can done?

update: seems there exists no easy way above. so, workaround, how can create single larger image tiling multiple smaller images in wp8.1 rt?

in code have instantiated 1 bitmap image. tho, i'm not sure, if memory conserving.

{       int n = 5;       grid grid = new grid();       bitmapimage bitmapimage = new bitmapimage(new uri("pack://application:,,,/stackoverflowtest;component/1.jpg"));       (int = 0; < n; i++)       {           grid.columndefinitions.add(new columndefinition {width = gridlength.auto});           grid.rowdefinitions.add(new rowdefinition {height= gridlength.auto});       }       (int = 0; < n; i++)       {           (int j = 0; j < n; j++)           {                               image image = new image { source = bitmapimage };               grid.setrow(image, i);               grid.setcolumn(image, j);               grid.children.add(image);           }       }       containerofgrid.children.add(grid); } 

edit:

i have checked, , seems me, in immediate window, source image not allocated multiple times.

((system.windows.controls.image)((new system.linq.systemcore_enumerabledebugview(((system.windows.controls.panel)(grid)).children)).items[0]))._bitmapsource.gethashcode() 37855919 ((system.windows.controls.image)((new system.linq.systemcore_enumerabledebugview(((system.windows.controls.panel)(grid)).children)).items[1]))._bitmapsource.gethashcode() 37855919 ((system.windows.controls.image)((new system.linq.systemcore_enumerabledebugview(((system.windows.controls.panel)(grid)).children)).items[0])).gethashcode() 19914648 ((system.windows.controls.image)((new system.linq.systemcore_enumerabledebugview(((system.windows.controls.panel)(grid)).children)).items[1])).gethashcode() 3378500 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -