1 // enable thread loading 2 Action A = () => 3 {4 var ROW = 7; 5 var column = 9; 6 7 var Path = ".. /.. /face_img/"; 8 var files = directory. getfiles (PATH); 9 for (VAR I = 0; I <row; I ++) 10 {11 facegrid. rowdefinitions. add (New rowdefinition (); 12} 13 for (VAR I = 0; I <column; I ++) 14 {15 facegrid. columndefinitions. add (New columndefinition (); 16} 17 var Index = 0; 18 for (VAR I = 0; I <row; I ++) 19 {20 for (var j = 0; j <column; j ++, index ++) 21 {22 if (index <files. length) 23 {24 var BTN = new button {width = 25, Height = 25}; 25 var image = new gifimage {source = system. io. path. getfullpath (files [Index]), stretch = stretch. fill}; 26 BTN. click + = btn_click; 27 image. tooltip = "[" + system. io. path. getfilename (files [Index]) + "]"; 28 BTN. tag = "[" + system. io. path. getfilename (files [Index]) + "]"; 29 image. opacitymask = This. background; 30 image. width = BTN. width-1; 31 image. height = BTN. height-1; 32 BTN. borderbrush = brushes. whitesmoke; 33 BTN. background = brushes. white; 34 BTN. content = image; 35 grid. setrow (BTN, I); 36 grid. setcolumn (BTN, J); 37 38 facegrid. children. add (BTN); 39} 40} 41} 42}; 43 this. facegrid. dispatcher. invoke ();Layout