Ich habe Daten Tabelle mit rund 66 Spalten und 4000 ZeilenWPF-Datengitter. Ändern Sie einzelne Zelle Hintergrund
jede Reihe kommt zu einem gewissen Kategorie von einigen bedingt basierend Färbung
Ich bin sehr neu in WPF tatsächlich i eine Bedingung basierend Färbung umgesetzt haben die Zeilen in Datagridview, aber WPF als Komponente DATENRITTER
Wie Zell basierte Färbung basierend auf Zelle Wert zu erreichen? in WPF
früher tat ich etwas, was wie dies in Win
public DataGridView colorGridview(DataGridView G)
{
string[] cellsrequired = {"Colnames1",""colname2};
foreach (DataGridViewRow item in G.Rows)
{
foreach (DataGridViewCell cell in item.Cells)
{
if (cellsrequired.Contains(cell.OwningColumn.HeaderText))
{
string str = cell.FormattedValue.ToString().Trim();
// n/a
if (str != "N/A")// Or your condition
{
if (str == "SKIP")
{
cell.Style.BackColor = Color.Orange;
}
else if (str == "FAIL")
{
cell.Style.BackColor = Color.Red;
}
else if (str == "INC")
{
cell.Style.BackColor = Color.Yellow;
}
else
{
cell.Style.BackColor = Color.SpringGreen;
}
}
}
}
}
foreach (DataGridViewRow item in G.Rows)
{
if (object.Equals(item.Cells[35].Value, "FAIL"))
{
var myparts = item.Cells[0].Value.ToString();
String[] CondtionsonCA = Getcondtion(myparts);
foreach (DataGridViewCell cell2 in item.Cells)
{
if (CondtionsonCA.Contains(cell2.OwningColumn.HeaderText))
{
string str = cell2.FormattedValue.ToString().Trim();
cell2.Style.BackColor = checkForColour(str);
}
}
}
}
return G;
}
ist es WPF oder WinForms? – StepUp