[英]WPF two way mode binding using INotifyPropertyChanged not working
[英]Image binding two way mode not working wpf c#
我的窗口中有一個圖像標簽,每當我以單向模式綁定它時,它都可以正常工作,但無法以雙向模式進行綁定。
<ComboBox Grid.Column="1" DisplayMemberPath="sm.admno" Grid.Row="0" Name="txtadm" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" IsEditable="True"/>
<Image Grid.Column="6" Grid.Row="0" Source="{Binding ElementName=txtadm, Mode=TwoWay, Path=SelectedItem.sp.pic, UpdateSourceTrigger=PropertyChanged}" Grid.RowSpan="4" Grid.ColumnSpan="2" Name="imgpic"/>
我正在使用的課程
public string admno { get; set; }
public byte[] pic { get; set; }
數據綁定源
var dt = from sm in db.studentmains
join sp in db.StudentPersonals on sm.admno equals sp.admno
select new { sm, sp};
txtadm.ItemsSource = dt.ToList();
Image.Source
不是TwoWay
有任何意義的屬性,控件不是交互式的,它不會改變源。 如果你修改它,你應該修改數據,而不是Image.Source
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.