Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

xaml - WPF : How to create separate Resources for each item in a bound ItemsControl -


i want achieve following:

  • my viewmodel exposes property named 'categories' collection of categoryviewmodel objects
  • each categoryviewmodel object exposes property called 'items' collection of strings*.
  • on view, want tabcontrol tabitem each object in 'categories' collection.
  • the content of each tabitem should xceed datagrid control displaying contents of selected tab's items collection.

    <tabcontrol itemssource="{binding categories}">     <tabcontrol.itemtemplate>         <datatemplate>             <textblock text="{binding categoryname}" />         </datatemplate>     </tabcontrol.itemtemplate>     <tabcontrol.contenttemplate>         <datatemplate>             <xcdg:datagridcontrol                     itemssource="{binding items}"                     autocreatecolumns="true">             </xcdg:datagridcontrol>         </datatemplate>     </tabcontrol.contenttemplate> </tabcontrol> 

this works ok when bind directly itemssource property of datagridcontrol. however, in order utilize of functionality of datagridcontrol, need bind itemssource property of datagridcontrol datagridcollectionviewsource object bound items collection. when grid isn't nested in control creating datagridcollectionviewsource object in resources section of usercontrol , binding that.

<usercontrol>     <usercontrol.resources>         <xcdg:datagridcollectionviewsource x:key="griddata"             source="{binding items}" />     </usercontrol.resources>     <grid>         <xcdg:datagridcontrol                 itemssource="{binding source={staticresource griddata}}"                 autocreatecolumns="true">         </xcdg:datagridcontrol>     </grid> </usercontrol> 

how need structure xaml when tabcontrol being bound, datagridcollectionviewsource object created each tabitem datagridcontrol generated within content of tabitem can bound it?

clear mud, right? :)

thanks!

notes:

*in real solution collection contains objects of class more complex simple string, string used make example more simple.

ok, bit of long-shot, use datagrid.tag ...

<tabcontrol.contenttemplate>     <datatemplate>         <xcdg:datagridcontrol                 itemssource="{binding relativesource={relativesource self}, path=tag}"                 autocreatecolumns="true">             <xcdg:datagridcontrol.tag>                  <xcdg:datagridcollectionviewsource x:key="griddata"                       source="{binding items}" />             </xcdg:datagridcontrol.tag>         </xcdg:datagridcontrol>     </datatemplate> </tabcontrol.contenttemplate> 

or ... resources can defined on frameworkelement, try:

<tabcontrol.contenttemplate>     <datatemplate>         <xcdg:datagridcontrol                 itemssource="{binding source={staticresource griddata}}"                 autocreatecolumns="true">             <xcdg:datagridcontrol.resources>                  <xcdg:datagridcollectionviewsource x:key="griddata"                       source="{binding items}" />             </xcdg:datagridcontrol.resources>         </xcdg:datagridcontrol>     </datatemplate> </tabcontrol.contenttemplate> 

i don't use exceed grid cannot test whether these work - couple of ideas try!

colin e.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -