c# - ValueConverter only firing once -
c# - ValueConverter only firing once -
i have wpf value converter convert items of items command firing when xaml view loaded.
my issue value converter appears not firing when itemssource collection raises notify property changed event.
here xaml:
<itemscontrol itemssource="{binding stackupviewmodel.layers}"> <itemscontrol.itemtemplate> <datatemplate> <contentpresenter> <contentpresenter.content> <multibinding converter="{staticresource layertorectangle}"> <binding /> <binding elementname="rgv"/> </multibinding> </contentpresenter.content> </contentpresenter> </datatemplate> </itemscontrol.itemtemplate>
here converter
public object convert( object[] values, type targettype, object parameter, system.globalization.cultureinfo culture) { var layer = values.first() layer; var radgridview = values[1] radgridview; var column = radgridview.columns["lamination"]; var row = radgridview.items[0]; var celltoedit = new gridviewcellinfo(row, column, radgridview); radgridview.currentcellinfo = celltoedit; radgridview.focus(); rectangle rectangle = new rectangle(); if (radgridview.currentcell != null) { point p = radgridview.currentcell.translatepoint(new point(0, 0), radgridview); rectangle.height = radgridview.rowheight - 10; rectangle.width = column.actualwidth; rectangle.fill = (solidcolorbrush)new brushconverter().convertfrom(layer.colorhex); canvas.settop(rectangle, p.y + layer.layernumber); canvas.setleft(rectangle, p.x); } homecoming rectangle; }
i added button xaml fire notifypropertychanged on layers observable collection so:
<button name="btndraw" command="{binding stackupviewmodel.scrollcommand}" /> private void scrollcommandhandler(object offset) { raisepropertychanged(() => this.layers); }
can advise me why converter isn't getting fired when button clicked?
the context of first binding individual layer
object not layers
parent collection multibinding won't register propertychanged
when phone call scrollcommandhandler
method.
c# wpf ivalueconverter
Comments
Post a Comment