c# - WPF color matrix -


i have created class called matrix (matrix [,] matrix;) , there have , j attributes, refer corresponding row , column.

let's say, example, [1,6] cell contains number 6 (the content not matter example), or want represent red color since 6 greater 5.

what wondering best , easiest way represent matrix in grid (grid, datagrid, ...) , example change [1,6] element of grid red color, displaying original matrix. example had dows not work, in fact not create grid:

system.data.datatable dt = new system.data.datatable(); ...loop dt... dt.columns.add(); dt.rows.add(); datagrid1.datasource = dt; 

thanks in advance!

this 1 of many possible solutions:

<itemscontrol itemssource="{binding somematrix}">     <itemscontrol.itemspanel>         <itemspaneltemplate>             <uniformgrid isitemshost="true" columns="{binding somematrix.columns}" />         </itemspaneltemplate>     </itemscontrol.itemspanel>     <itemscontrol.itemtemplate>         <datatemplate>             <label content="{binding}" horizontalcontentalignment="center" />         </datatemplate>     </itemscontrol.itemtemplate> </itemscontrol> 

u can change appearance of individual cells modyfying item template. prerequisite matrix class should implement ienumerable interface , should yield items in column-by-column, row-by-row order.


Comments

Popular posts from this blog

How to show in django cms breadcrumbs full path? -

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -