Home > Net >  WPF DataGrid data binding problem
WPF DataGrid data binding problem

Time:12-19


 
XMLNS="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
XMLNS: x="http://schemas.microsoft.com/winfx/2006/xaml"
XMLNS: d="http://schemas.microsoft.com/expression/blend/2008"
XMLNS: MC="http://schemas.openxmlformats.org/markup-compatibility/2006"
XMLNS: local="CLR - namespace: CSTK. Library. DownLoad"
MC: Ignorable="d"
Title="download center" Height="542.406" Width="1016.225" WindowStartupLocation="CenterScreen ResizeMode"="NoResize" MaxHeight="532.406" MaxWidth="1000" & gt;



The background code
 
Public class SongDetail {
Public string ID {get; set; }
Public string SongName {get; set; }
Public string AlbumName {get; set; }
Public string SingerName {get; set; }
}
System. The Threading. Thread th=new System. Threading. Thread (()=& gt;
{
Var RST=HttpHelper. HttpPost (url, data, HttpHelper. Cookies, "application/x - WWW - form - urlencoded; charset=UTF-8");
Var root=JsonToEntity (RST);
ObservableCollection SongItems=new ObservableCollection (a);
Foreach (var song in root. Song_list)
{
String name=song. Songname;
Var arr=song. Songname. Split (new string [] {& lt; "" Sup "}, StringSplitOptions. None);
If (arr!=null & amp; & Arr. Length & gt; 1) name=arr [0].
Song. Songname=name;
Var singer=song. The singer. FirstOrDefault ();
SongItems. Add (new SongDetail () {ID=song. Songmid SongName=name, AlbumName=song. AlbumName, SingerName singer of===null?" ": the singer. The name});
}
Dg_Table. Dispatcher. Invoke (delegate () {
Dg_Table. ItemsSource=songItems;
//dg_Table GridLinesVisibility=DataGridGridLinesVisibility. All;
});
});
Th. IsBackground=true;
Th. The Start ();

Look at the picture, I have a value statement column, this is normal, but the attribute column is what circumstance, the baidu along while didn't find the reason,
Code about these, recently are learning WPF, may be used in the future work, hope everybody a great god help!

CodePudding user response:

Don't understand what you mean

CodePudding user response:

I'm only five columns, the other comes out more is how to return a responsibility
  • Related