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.

wpf - MVVM and Databinding with UniformGrid -


i'm trying style of wpf chart rectangles. i'm using mvvm, , need rectangles uniformly sized. when defined via xaml, works fixed "bucketcount" of 4:

<visualbrush>   <visualbrush.visual>   <uniformgrid height="500" width="500" rows="1" columns="{binding bucketcount}">     <rectangle grid.row="0" grid.column="0" fill="#22add8e6" />     <rectangle grid.row="0" grid.column="1" fill="#22d3d3d3"/>     <rectangle grid.row="0" grid.column="2" fill="#22add8e6"/>     <rectangle grid.row="0" grid.column="3" fill="#22d3d3d3"/>   </uniformgrid>          </visualbrush.visual> <visualbrush> 

how can bind observablecollection of rectangles? there no "itemssource" property on uniformgrid. need use itemscontrol? if so, how can this?

thanks in advance.

you use itemscontrol bind this. simple example itemssource observablecollection<brush>

<visualbrush>     <visualbrush.visual>         <itemscontrol x:name="itemscontrol" itemssource="{binding mybrushes}">             <itemscontrol.itemspanel>                 <itemspaneltemplate>                     <uniformgrid height="500" width="500" rows="1"/>                 </itemspaneltemplate>             </itemscontrol.itemspanel>             <itemscontrol.itemtemplate>                 <datatemplate>                     <rectangle fill="{binding}"/>                 </datatemplate>             </itemscontrol.itemtemplate>         </itemscontrol>     </visualbrush.visual> </visualbrush> 

update
works usage scenario, might missing here. here's full code i've tried. same result both

mainwindow.xaml

<grid>     <grid.background>         <visualbrush>             <visualbrush.visual>                 <itemscontrol x:name="itemscontrol" itemssource="{binding mybrushes}">                     <itemscontrol.itemspanel>                         <itemspaneltemplate>                             <uniformgrid height="500" width="500" rows="1"/>                         </itemspaneltemplate>                     </itemscontrol.itemspanel>                     <itemscontrol.itemtemplate>                         <datatemplate>                             <rectangle fill="{binding}"/>                         </datatemplate>                     </itemscontrol.itemtemplate>                 </itemscontrol>                 <!--<uniformgrid height="500" width="500" rows="1" columns="4">                     <rectangle grid.row="0" grid.column="0" fill="#22add8e6" />                     <rectangle grid.row="0" grid.column="1" fill="#22d3d3d3"/>                     <rectangle grid.row="0" grid.column="2" fill="#22add8e6"/>                     <rectangle grid.row="0" grid.column="3" fill="#22d3d3d3"/>                 </uniformgrid>-->             </visualbrush.visual>         </visualbrush>     </grid.background> </grid> 

mainwindow.xaml.cs

public partial class mainwindow : window {     public mainwindow()     {         initializecomponent();         brushconverter brushconverter = new brushconverter();         mybrushes = new observablecollection<brush>();         mybrushes.add(brushconverter.convertfrom("#22add8e6") brush);         mybrushes.add(brushconverter.convertfrom("#22d3d3d3") brush);         mybrushes.add(brushconverter.convertfrom("#22add8e6") brush);         mybrushes.add(brushconverter.convertfrom("#22d3d3d3") brush);         this.datacontext = this;     }      public observablecollection<brush> mybrushes     {         get;         set;     } } 

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 -