c# - Add items to wpf DataGrid in design mode -
i have kind of complex type (with nested class)
namespace restore { public class item { public string title { get; set; } public imagesource image { get; set; } } public class itemsummary { public imagesource status { get; set; } public item item { get; set; } public string description { get; set; } } }
and xaml
<window x:class="restore.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:restore" <window.resources> <bitmapimage x:key="error" urisource="../../images/error.png" /> </window.resources> <datagrid> <datagrid.columns> <datagridtemplatecolumn header="status" width="45" > <datagridtemplatecolumn.celltemplate> <datatemplate> <image source="{binding status}" width="16" height="16" /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> <datagridtemplatecolumn header="object" width="*"> <datagridtemplatecolumn.celltemplate> <datatemplate> <stackpanel orientation="horizontal"> <image source="{binding item.image}" width="16" height="16" /> <textblock text="{binding item.title}" /> </stackpanel> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> <datagridtextcolumn header="description" width="*" binding="{binding description}" /> </datagrid.columns> <local:itemsummary item="{???}" status="{staticresource error}" description="1 item" /> <local:itemsummary item="{???}" status="{staticresource success}" description="2 item" /> <local:itemsummary item="{???}" status="{staticresource warning}" description="3 item" /> </datagrid> </window>
i don't know how set item value item="{???}"
Comments
Post a Comment