我在WPF
中有一个表格,我将ObservableCollection<Message> TableData
Message
列表绑定到StatusColor
。我设置表格行的样式,使其可以读取消息ObservableCollection<Message>
(更改文本的颜色)。当我向StatusColor
添加元素时,此功能正常,但当我更改public class Message
{
public string ShortTextMessage { get; set; }
public string StatusColor { get; set; }
}
时,更改未在UI中更新。
代码:
<Style x:Key="DataGridRow" TargetType="{x:Type DataGridRow}">
<Setter Property="Foreground" Value="{Binding StatusColor, Mode=TwoWay}"></Setter>
</Style>
<DataGrid ItemsSource="{Binding TableData}" SelectedItem="{Binding TableData, Mode=TwoWay}" RowStyle="{StaticResource DataGridRow}" SelectionUnit="FullRow">
XAML:
import org.apache.spark.sql.functions._
val numericvalue = 1
val column = when(
datediff(col("DueDate"), col("manufacturedate")) > col("LeadTime"), lit(numericvalue)
).otherwise(col("PartSource.EffLeadTime"))
val result = df.withColumn("newVal", column)
答案 0 :(得分:4)
为您的班级<?php
/**
* @author AmirMohammad
* @copyright 2016
*/
include('../ss_engine/config.php');
if(isset($_POST['submit'])) {
$lessons[] = $_POST['lesson'];
$sql="CREATE TABLE IF NOT EXISTS darsha(
`id` INT NOT NULL AUTO_INCREMENT,
`sid` INT(6) NOT NULL,
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
`class` VARCHAR(255) NOT NULL,
$lessons FLOAT NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci";
$result = $conn->query($sql);
if($result) {
echo 'success';
} else {
echo 'Error adding data'.$conn->error;
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>تعریف دروس</title>
</head>
<body>
<form action="" method="POST">
<table style="border: 1px solid #454545;width: 100%;">
<tr>
<td>lesson 1</td>
<td><input type="text" name="lesson[]" /></td>
</tr>
<tr>
<td>lesson 2</td>
<td><input type="text" name="lesson[]" /></td>
</tr>
<tr>
<td>lesson 3</td>
<td><input type="text" name="lesson[]" /></td>
</tr>
<tr>
<td>lesson 4</td>
<td><input type="text" name="lesson[]" /></td>
</tr>
<tr>
<td>lesson 5</td>
<td><input type="text" name="lesson[]" /></td>
</tr>
<tr>
<td><input type="submit" value="submut" name="submit" /></td>
<td><button>add new field</button></td>
</tr>
</table>
</form>
</body>
</html>
实施INotifyPropertyChanged
:
Message
继承 public abstract class ViewModelBase : INotifyPropertyChanged
{
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
ValidateAsync();
}
#endregion
}
:
ViewModelBase
这应该有效。