c# - Silverlight: update listbox template item -
opens i new panel at an event I have Suchiboks on where I change data Suchiboksejh am, more accurate image source I The problem is how to update the listback to get a new picture Thanks in advance. Here is my code:
& lt; Listbox x: Name = "LbNarudzbe" mouse Leftbutnuf = "Elbianurudghbimauseuftbitonap" Kshatijelinetment = "center" Makshait = "600" & gt; & Lt; ListBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image margin = "0,5,0,0" width = "50" height = "50" horizontal align = "center" source = "{binding path = picture}" /> & Lt; TextBlock horizontal alignment = "center" fontSize = "23" text = "{binding path = ukupana cejena}" width = "80" /> & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt; & Lt; /ListBox.ItemTemplate> & Lt; / ListBox & gt; Public Partial Category Page: User Control {ObservedClonation & lt; Narduza & gt; Narudzbe = New Observational Collection & lt; Narduza & gt; (); Public page () {InitializeComponent (); Narudzbe.Add (New Narudzba ()); Narudzbe.Add (New Narudzba ()); Narudzbe.Add (New Narudzba ()); Narudzbe.Add (New Narudzba ()); LbNarudzbe.ItemsSource = narudzbe; } Public class Narudzba {// ... public string photo {return} "photo source"; }} .....
basically when you want to update picture listbox, you are updated picture property of their Narudzba class, and since you can not update your Narudzba class listbox picture interface does not implement INotifyPropertyChanged.
Here are some code that can help.
public class Nardughaba: Sistmkkanpanentmodelkinotifiproprteepriwartit {public event Sistmkkanpanentmodelkproprti change Chenjedaventhandlr property; Zero notification (string Pronam) {if (property changed! = Null) {property has changed (this, new Sistmkkanpanentmodelkproprti Chenglted Iventarj (Propanam)); }} String _pictures; Public string photo {get {return_picturesource; } Set {_picturesource = value; Notify ("picture"); }} Public Narada (string photo processing) {_picturesource = photosource; }}} Then lbNarudzbe_MouseLeftButtonUp event code should look like this
private void lbNarudzbe_MouseLeftButtonUp (object sender, MouseButtonEventArgs e) {Narudzba nb = (Narudzba) lbNarudzbe .SelectedItem; Nb.Picture = "http://somedomain.com/images/newpicture.jpg"; } hh
Comments
Post a Comment