<Usercontrol xmlns: My = "CLR-namespace: system. Windows. controls; Assembly = system. Windows. Controls. Data" X: class = "controltest. Page"
Xmlns = "http://schemas.microsoft.com/client/2007"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Width = "800" Height = "600" loaded = "usercontrol_loaded">
<Grid X: Name = "layoutroot" background = "black">
<Canvas X: Name = "dgcas" canvas. Top = "0" canvas. Left = "200">
<My: DataGrid X: Name = "mydg" gridlinesvisibility = "NONE" headersvisibility = "NONE" width = "400" Height = "300">
<My: DataGrid. Columns>
<! -- <My: Maid = "" width = "20"> </My: Maid> -->
<My: Maid = "{binding commentid}" width = "20"> </My: Maid>
<My: Maid = "{binding commentcontent}" width = "200"> </My: Maid>
<My: Maid = "{binding postpeople}" width = "80"> </My: Maid>
<! -- <My: Maid = "{binding posttime}" width = "80"> </My: Maid> -->
<My: Maid width = "80">
<My: datagridtemplatecolumn. celltemplate>
<Datatemplate>
<Textblock text = "{binding posttime}" fontfamily = "trebuchet ms" fontsize = "11" margin = "5, 4, 5, 4"/> </datatemplate>
</My: datagridtemplatecolumn. celltemplate>
<My: datagridtemplatecolumn. celleditingtemplate>
<Datatemplate>
<Datepicker selecteddate = "{binding posttime, mode = twoway}" selecteddateformat = "short"/>
</Datatemplate>
</My: datagridtemplatecolumn. celleditingtemplate>
</My: datagridtemplatecolumn>
<My: Maid = "{binding postip}" visibility = "Collapsed"> </My: Maid>
</My: DataGrid. Columns>
</My: DataGrid>
</Canvas>
<Canvas X: Name = "listcas" canvas. Top = "0" canvas. Left = "200">
<ListBox X: Name = "mylist" canvas. Top = "300" width = "400" Height = "300">
<ListBox. itemtemplate>
<Datatemplate>
<Stackpanel orientation = "vertical">
<Stackpanel style = "{staticresource floorpanel}">
<Textblock text = "{binding commentid}" horizontalalignment = "Left" fontsize = "12" foreground = "red"> </textblock>
<Textblock text = "{binding postpeople}" horizontalalignment = "Left" fontsize = "12" textwrapping = "Wrap" maxwidth = "80" fontweight = "bold" width = "100"> </textblock>
<Textblock text = "{binding posttime}" horizontalalignment = "Left" fontsize = "12" textwrapping = "Wrap" maxwidth = "80" fontweight = "semibold"> </textblock>
</Stackpanel>
<Textblock text = "{binding commentcontent}" textwrapping = "Wrap" maxwidth = "300" fontsize = "12" horizontalalignment = "Left"> </textblock>
</Stackpanel>
</Datatemplate>
</ListBox. itemtemplate>
</ListBox>
</Canvas>
</GRID>
</Usercontrol>
Mydg. itemssource = "helloworld". Split ();
List <comment> lst = new list <comment> ();
For (INT I = 1; I <10; I ++)
{
Lst. Add (New Comment ()
{
Commentid = I,
Commentcontent = "There must be a flexible monetary policy system to cope with the subprime mortgage crisis. After the subprime mortgage crisis, some countries experienced liquidity tightening. This "liquidity shortage" is the representation or essence and needs to be discussed. ",
Postpeople = "Zhou Xiaochuan ",
Posttime = datetime. Now. tolongtimestring (),
Postip = "127.0.0.1"
});
}
// Mydg. itemssource = lst;
Mylist. itemssource = lst;