本文整理汇总了C#中System.Windows.Controls.DataGridTextColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridTextColumn类的具体用法?C# DataGridTextColumn怎么用?C# DataGridTextColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridTextColumn类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridTextColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitGrid
/// <summary>
/// 初始化Grid
/// </summary>
void InitGrid()
{
dgrid.Name = Utility.GetResourceStr("PEOPLECHARGEAPPLY");
DataGridTextColumn dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("CHARGEAPPLYMASTERCODE");
dgtextColumn.Header = "单据编号";
dgrid.Columns.Add(dgtextColumn);
dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("BANKCARDNUMBER");
dgtextColumn.Header = "帐号";
dgrid.Columns.Add(dgtextColumn);
dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("EMPLOYEECNAME");
dgtextColumn.Header = "户名";
dgrid.Columns.Add(dgtextColumn);
dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("TOTALMONEY");
dgtextColumn.Header = "金额";
dgrid.Columns.Add(dgtextColumn);
dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("BANKID");
dgtextColumn.Header = "开户行";
dgrid.Columns.Add(dgtextColumn);
dgtextColumn = new DataGridTextColumn();
dgtextColumn.Binding = new Binding("BANKADDRESS");
dgtextColumn.Header = "开户地";
dgrid.Columns.Add(dgtextColumn);
}
示例2: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
DataGridTextColumn c1 = new DataGridTextColumn();
c1.Header = "Name";
c1.Binding = new Binding("Name");
c1.Width = 80;
dataGrid1.Columns.Add(c1);
DataGridTextColumn c2 = new DataGridTextColumn();
c2.Header = "Email";
c2.Width = 120;
c2.Binding = new Binding("Email");
dataGrid1.Columns.Add(c2);
DataGridTextColumn c3 = new DataGridTextColumn();
c3.Header = "UIN";
c3.Width = 80;
c3.Binding = new Binding("UIN");
dataGrid1.Columns.Add(c3);
dataGrid1.Items.Add(new Item() { Name = "Sherni Minu", Email = "srajaram", UIN = "00905111" });
dataGrid1.Items.Add(new Item() { Name = "Hari Phaneendra", Email = "hkalyan", UIN = "00901369" });
//Add Items to the dropdown box
comboBox1.Items.Add("Manual");
comboBox1.Items.Add("Automatic");
comboBox1.SelectedIndex = 0;
}
示例3: GetColumns
public DataGridTextColumn[] GetColumns() {
var result = new DataGridTextColumn[12];
for (int i = 0; i < result.Length; i++) {
result[i] = new DataGridTextColumn();
//result[i].
result[i].IsReadOnly = true;
}
result[0].Header = "Date";
result[0].Binding = new Binding("DateStr");
result[1].Header = "Time (Hours)";
result[1].Binding = new Binding("TimeStr");
result[2].Header = "Temperature" + ( TemperatureUnits == "" ? "" : " (" + TemperatureUnits + ")" );
result[2].Binding = new Binding("Temperature");
result[3].Header = "Precipitation Value" + ( PrecipitationUnits == "" ? "" : " (" + PrecipitationUnits + ")" );
result[3].Binding = new Binding("Precipitation");
result[4].Header = "Precipitation Descr";
result[4].Binding = new Binding("PrecipitationDescription");
result[5].Header = "Clouds Value" + ( CloudsUnits == "" ? "" : " (" + CloudsUnits + ")" );
result[5].Binding = new Binding("Clouds");
result[6].Header = "Clouds Descr";
result[6].Binding = new Binding("CloudsDescription");
result[7].Header = "Wind Direction";
result[7].Binding = new Binding("WindDirection");
result[8].Header = "Wind Speed" + ( WindUnits == "" ? "" : " (" + WindUnits + ")" );
result[8].Binding = new Binding("WindSpeed");
result[9].Header = "Wind Descr";
result[9].Binding = new Binding("WindDescription");
result[10].Header = "Pressure" + ( PressureUnits == "" ? "" : " (" + PressureUnits + ")" );
result[10].Binding = new Binding("Pressure");
result[11].Header = "Humidity" + ( HumidityUnits == "" ? "" : " (" + HumidityUnits + ")" );
result[11].Binding = new Binding("Humidity");
//result[11].Width = DataGridLength.SizeToHeader;
return result;
}
示例4: winReplace
public winReplace(string keyTotal, string Determ, string child, string f)
{
InitializeComponent();
DataGridTextColumn column = new DataGridTextColumn();
column.Header = Determ;
dgridParent.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = child;
dgridParent.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = keyTotal;
dgridParent.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = keyTotal;
dgridChild1.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = Determ;
dgridChild1.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = Determ;
dgridChild2.Columns.Add(column);
column = new DataGridTextColumn();
column.Header = child;
dgridChild2.Columns.Add(column);
}
示例5: ToPrintFriendlyGrid
public static DataGrid ToPrintFriendlyGrid(this DataGrid source,PagedCollectionView pcv)
{
DataGrid dg = new DataGrid();
dg.ItemsSource = pcv;
dg.AutoGenerateColumns = false;
for (int i = 0; i < source.Columns.Count; i++)
{
DataGridTextColumn newColumn = new DataGridTextColumn();
DataGridTextColumn column = (DataGridTextColumn)source.Columns[i];
newColumn.Header = column.Header;
System.Windows.Data.Binding bind;
if (column.Binding != null)
{
bind = new System.Windows.Data.Binding();
bind.Path = column.Binding.Path;
//bind.Converter = column.Binding.Converter;
}
else
bind = new System.Windows.Data.Binding();
newColumn.Binding = bind;
dg.Columns.Add(newColumn);
}
return dg;
}
示例6: AddColumn
private void AddColumn(String header, String binding)
{
DataGridTextColumn column = new DataGridTextColumn();
column.Header = header;
column.Binding = new Binding(binding);
dgvStudents.Columns.Add(column);
}
示例7: IndividualPatientsbyNameWindow
public IndividualPatientsbyNameWindow()
{
InitializeComponent();
// Initialize the data grid and establish the columns.
DataGridTextColumn col1_n = new DataGridTextColumn();
DataGridTextColumn col2_n = new DataGridTextColumn();
DataGridTextColumn col3_n = new DataGridTextColumn();
DataGridTextColumn col4_n = new DataGridTextColumn();
DataGridTextColumn col5_n = new DataGridTextColumn();
DataGridTextColumn col6_n = new DataGridTextColumn();
data_grid_n.Columns.Add(col1_n);
data_grid_n.Columns.Add(col2_n);
data_grid_n.Columns.Add(col3_n);
data_grid_n.Columns.Add(col4_n);
data_grid_n.Columns.Add(col5_n);
data_grid_n.Columns.Add(col6_n);
col1_n.Header = "Patient ID";
col2_n.Header = "First Name";
col3_n.Header = "Last Name";
col4_n.Header = "Blood Type";
col5_n.Header = "Amount Required";
col6_n.Header = "Hospital ID";
// Binding allows the data grid to automatically grab values from variables.
col1_n.Binding = new Binding("patientid_n");
col2_n.Binding = new Binding("firstname_n");
col3_n.Binding = new Binding("lastname_n");
col4_n.Binding = new Binding("bloodtype_n");
col5_n.Binding = new Binding("amount_n");
col6_n.Binding = new Binding("hospitalid_n");
}
示例8: initTable
void initTable(List<nsConf> pre_config)
{
//config_to_return = pre_config;
if (pre_config != null)
{
//m_nstab.ItemsSource = pre_config;
}
else
{
/* List<nsConf> data_source = new List<nsConf>();
data_source.Add(new_conf);
m_nstab.ItemsSource = data_source; */
nsConf_inner new_conf = new nsConf_inner()
{
ns = "Hello",
source = "World!"
};
DataGridItemsSource.Add(new_conf);
m_nstab.ItemsSource = DataGridItemsSource;
m_nstab.Items.Refresh();
DataGridItemsSource.Add(new_conf);
DataGridTextColumn ns_col = new DataGridTextColumn()
{
Binding = new Binding("ns") { Mode = BindingMode.TwoWay }
};
m_nstab.Columns.Add(ns_col);
DataGridTextColumn ns_source_col = new DataGridTextColumn()
{
Binding = new Binding("source") { Mode = BindingMode.TwoWay }
};
m_nstab.Columns.Add(ns_source_col);
}
}
示例9: MainWindow
pageRecord m_recordPage; //List with page records
#endregion Fields
#region Constructors
/// <summary>
/// This method performs a connection to the server,get the first page
/// of records and populate the grid with it.
/// </summary>
public MainWindow()
{
InitializeComponent();
ChannelFactory<IDataController> dataFactory;
NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.MaxReceivedMessageSize = System.Int32.MaxValue;
tcpBinding.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;
string sURL = "net.tcp://localhost:50001/Data";
dataFactory = new ChannelFactory<IDataController>(tcpBinding, sURL);
m_data = dataFactory.CreateChannel();
string [] columns = m_data.GetColumnNames();
/*Binds the columns with the name of the fields of the table*/
foreach (string name in columns)
{
DataGridTextColumn textcol = new DataGridTextColumn();
Binding b = new Binding(name);
textcol.Binding = b;
textcol.Header = name;
dgrdData.Columns.Add(textcol);
}
m_recordPage = new pageRecord();
txtPage.Text = "1";
UpdateDataGrid(1);
}
示例10: AddColumn
void AddColumn(int type, string headerText, string binding)
{
if (type == 0 || type == 1)
{
DataGridBoundColumn col = null;
if (type == 0)
col = new DataGridTextColumn();
else
col = new DataGridCheckBoxColumn();
col.Header = headerText;
col.Binding = new Binding(binding);
dataGrid.Columns.Add(col);
}
else if (type == 2)
{
DataGridComboBoxColumn col = new DataGridComboBoxColumn();
col.Header = headerText;
//col.SelectedValueBinding = new Binding(binding);
//col.SelectedValuePath = "Value";
//col.DisplayMemberPath = "Value";
col.TextBinding = new Binding(binding);
col.ItemsSource = Enum.GetNames(typeof(ocNet.Lib.DBTable.TableFieldType));
dataGrid.Columns.Add(col);
}
}
示例11: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
if (cb2.Items.Count == 0 || cb3.Items.Count == 0)
return;
String sdb = cb2.Text;
String stb = cb3.Text;
List<string> cols = db.getAllColumns(sdb, stb);
DataTable dt = new DataTable();
//очистка данных
lstw.Columns.Clear();
//TODO доделать
foreach (string data in cols)
{
DataGridTextColumn textColumn = new DataGridTextColumn();
textColumn.Header = data;
textColumn.Binding = new Binding(string.Format("[{0}]", data));
lstw.Columns.Add(textColumn);
//data table
dt.Columns.Add(data);
}
List<List<string>> sds = db.getDataOfTable(sdb, stb);
foreach (List<string> sd in sds)
{
dt.Rows.Add(sd.ToArray());
}
//context
lstw.DataContext = dt;
}
示例12: EditEventWindow
public EditEventWindow(Project pr, int evnum = 0)
{
InitializeComponent();
DataGridTextColumn col = new DataGridTextColumn();
col.Header = "Опис штрафу";
col.Width = new DataGridLength(180);
col.Binding = new Binding("Description");
PenaltiesGrid.Columns.Add(col);
col = new DataGridTextColumn();
col.Header = "Штраф(%)";
col.Width = new DataGridLength(70);
col.Binding = new Binding("Mode");
PenaltiesGrid.Columns.Add(col);
col = new DataGridTextColumn();
col.Header = "Штраф(бали)";
col.Width = new DataGridLength(85);
col.Binding = new Binding("Value");
PenaltiesGrid.Columns.Add(col);
PenaltyRow val = new PenaltyRow("Prosto tak", 0.5);
PenaltyRow mod = new PenaltyRow("Potomu chto loh", 50);
PenaltiesGrid.Items.Add(val);
PenaltiesGrid.Items.Add(mod);
DeadlineDate.SelectedDate = DateTime.Today;
CurPr = pr;
SerialNumber.Text = (CurPr.Events.Count + 1).ToString();
EventNumber = evnum;
OK.Content = "Зберегти";
DeadlineDate.SelectedDate = CurPr.Events[EventNumber].DeadLine;
Name.Text = CurPr.Events[EventNumber].Title;
Description.Text = CurPr.Events[EventNumber].Description;
SerialNumber.Text = CurPr.Events[EventNumber].SerialNumber.ToString();
}
示例13: MatrixShowDlg
public MatrixShowDlg(ICollection<string> names, int[,] matrix)
{
InitializeComponent();
foreach (var name in names)
{
var mView = new MatrixView(names.Count);
for (int i = 0; i < names.Count; i++)
{
mView.Value[i] = matrix[_mtx.Count, i];
}
mView.Name = name;
var bind = new Binding("Value[" + _mtx.Count + "]");
var textColumn = new DataGridTextColumn
{
Header = name,
Width = new DataGridLength(100),
Binding = bind,
IsReadOnly = true
};
_mtx.Add(mView);
DataGridMatrix.Columns.Add(textColumn);
}
DataGridMatrix.ItemsSource = _mtx;
}
示例14: ManageTeam
public ManageTeam()
{
InitializeComponent();
TeamDataParser td = new TeamDataParser();
//For now using team[0], first place team for testing purposes
myTeam = td.GetTeams()[0];
members = myTeam.Members;
header.Text = "Manage " + myTeam.TeamName;
//dataGrid population
DataGridTextColumn memberName = new DataGridTextColumn();
DataGridTextColumn memberScore = new DataGridTextColumn();
//add whatever other team member data we decide to put
//look back over and see if there is more efficient way to do this
teamData.Columns.Add(memberName);
teamData.Columns.Add(memberScore);
memberName.Binding = new Binding("name");
memberScore.Binding = new Binding("points");
memberName.Header = "Member Name";
memberScore.Header = "Member Score";
foreach (Employee empl in members)
{
teamData.Items.Add(new rowData { name = empl.GetName(), points = empl.GetPoints() });
}
}
示例15: IndividualPatientsWindow
public IndividualPatientsWindow()
{
InitializeComponent();
// Initialize the data grid and set up each column.
DataGridTextColumn col1_p = new DataGridTextColumn();
DataGridTextColumn col2_p = new DataGridTextColumn();
DataGridTextColumn col3_p = new DataGridTextColumn();
DataGridTextColumn col4_p = new DataGridTextColumn();
DataGridTextColumn col5_p = new DataGridTextColumn();
DataGridTextColumn col6_p = new DataGridTextColumn();
data_grid_p.Columns.Add(col1_p);
data_grid_p.Columns.Add(col2_p);
data_grid_p.Columns.Add(col3_p);
data_grid_p.Columns.Add(col4_p);
data_grid_p.Columns.Add(col5_p);
data_grid_p.Columns.Add(col6_p);
col1_p.Header = "Patient ID";
col2_p.Header = "First Name";
col3_p.Header = "Last Name";
col4_p.Header = "Blood Type";
col5_p.Header = "Amount Required";
col6_p.Header = "Hospital ID";
// Binding for the columns allows them to automatically grab values and insert them.
col1_p.Binding = new Binding("patientid_p");
col2_p.Binding = new Binding("firstname_p");
col3_p.Binding = new Binding("lastname_p");
col4_p.Binding = new Binding("bloodtype_p");
col5_p.Binding = new Binding("amount_p");
col6_p.Binding = new Binding("hospitalid_p");
}