【发布时间】:2011-04-08 18:12:50
【问题描述】:
我有一个TextBox,它的Text 属性绑定到一个名为Grade 的double 类型的属性。我也有一个 @987654325 @,当检查了 @987654326 @时,我希望 @987654327 @ @987654327 @拿一个自动计算值(即自动设置为maxScore/cormect of问题计数)。如果未选中CheckBox,那么我想手动设置和更改Grade。我的问题是我该如何实施?
<TextBox Height="23"
Visibility="{Binding Path=Visible2, Converter={StaticResource boolToVis}, UpdateSourceTrigger=PropertyChanged}"
Text="{Binding Path=Grade,UpdateSourceTrigger =PropertyChanged,Mode=TwoWay}"
HorizontalAlignment="Left" Margin="376,453,0,0"
Name="textBox3" VerticalAlignment="Top" Width="120" />
我把它绑定到:
public double Grade
{
get
{
return grade;
}
set
{
grade = value;
OnPropertyChanged("Grade");
foreach (ExaminationQuestion exaq in
this.Examination.ExaminationQuestions)
{
if (exaq.Question.Guid == SelectedQuestionDropList.Guid)
{
exaq.Grade = value;
}
}
}
}
谢谢
【问题讨论】:
标签: wpf data-binding textbox checkbox default