简体   繁体   中英

Image binding two way mode not working wpf c#

i have an image tag in my window, whenever i am binding it in one way mode, its working fine, but unable to two way mode.

<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"/>

class i am using

public string admno { get; set; }
public byte[] pic { get; set; }

data binding souce

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 is not a property for which TwoWay makes any sense, the control is not interactive, it's not going to change the source. If you modify it, you should modify the data, not the Image.Source .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM