c# - Bringing a Border into View -
i have tabitem
:
<tabitem x:name="tabtfgwreadingmainhall" header="main hall" datacontext="{binding meeting}"> <tabitem.style> <style targettype="{x:type tabitem}"> <setter property="isenabled" value="false"/> <setter property="isselected" value="false"/> <style.triggers> <datatrigger binding="{binding numberclasses, converterparameter=1, converter={staticresource isequalorgreaterthanconverter}}" value="true"> <setter property="isenabled" value="true" /> </datatrigger> <datatrigger binding="{binding selecteditem, elementname=comboactivestudentassignmenttype}" value="{x:static studentinfoenums:studentassignmenttype.biblereadingmain}"> <setter property="isselected" value="true"/> </datatrigger> </style.triggers> </style> </tabitem.style> <border x:name="borderbiblereadingmain" borderthickness="5"> <border.style> <style targettype="border"> <setter property="borderbrush" value="transparent"/> <style.triggers> <datatrigger binding="{binding selecteditem, elementname=comboactivestudentassignmenttype}" value="{x:static studentinfoenums:studentassignmenttype.biblereadingmain}"> <setter property="borderbrush" value="red"/> </datatrigger> </style.triggers> </style> </border.style> <stackpanel> <stackpanel.style> <style targettype="{x:type stackpanel}"> <setter property="isenabled" value="false"/> <style.triggers> <datatrigger binding="{binding numberclasses, converterparameter=1, converter={staticresource isequalorgreaterthanconverter}}" value="true"> <setter property="isenabled" value="true" /> </datatrigger> </style.triggers> </style> </stackpanel.style> <label content="student:"/> <grid> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <textbox x:name="textbiblereadingmain" grid.column="0" margin="2" isenabled="false" datacontext="{binding tfgw.biblereadingitem.main}" text="{binding datacontext.biblereadingmain, elementname=oclmeditor, mode=twoway, notifyonsourceupdated=true, updatesourcetrigger=propertychanged}"/> <button x:name="buttonbiblereadingmain" grid.column="1" background="transparent" datacontext="{binding datacontext, elementname=oclmeditor}" command="{binding applicationcommand}" commandparameter="biblereadingmain"> <image source="images/assignmenttypebiblereading16.png" margin="2"/> </button> </grid> <label content="study:"/> <combobox datacontext="{binding datacontext, elementname=oclmeditor}" itemssource="{binding readingstudypointslist}"> <combobox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock text="{binding number}"/> <textblock text=" - "/> <textblock text="{binding title}"/> </stackpanel> </datatemplate> </combobox.itemtemplate> </combobox> </stackpanel> </border> </tabitem>
as can see, has datatriggers
implemented. thus, when change comboactivestudentassignmenttype (over on right edge of editor):
this how controls on left change:
before:
after:
the datatriggers working right. border
set correctly , tabitem
gets selected. but, if possible, end this:
i have done research on , appears need use bringintoview desired results. needs called code behind. added selectionchanged handler , did this:
private void comboactivestudentassignmenttype_selectionchanged(object sender, selectionchangedeventargs e) { oclmeditorviewmodel vm = this.datacontext oclmeditorviewmodel; if(borderbiblereadingmain != null && vm.activestudentassignmenttype == data.studentinfo.enums.studentassignmenttype.biblereadingmain) borderbiblereadingmain.bringintoview(); // todo: add others here }
whilst did fired, did not seem make difference. still had scroll reactangle bring view.
how should doing this?
thank you.
Comments
Post a Comment