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.

c# - Resizing a grid control programatically over a period of time -


g'day,

i attempting simulate old xbox 360 gui sliding tabs (remember, you'd press left or right , content slide in depending on tab?) anyways, @ moment, have working well, cannot "animation" working.

when user presses left arrow or right arrow, openwindow(int iindex) method called, iindex index next or previous "window" slid in. (not window... each "window" struct parent grid control containing button , smaller grid control contains windows contents.)

now, problem lies resizing parent grid control. when slid in, resized calling mygrid.width += 1; works, don't see happen on determined period of time, lags bit , resizes required width. whereas if call this.width += 1 in same method, (this being main program window) window resizes how want grid control resize. i've tried updatelayout() no avail. tells me timing okay.

if of assistance, appreciated.

here openwindow method...

public void openwindow(int iindex)     {         int iinterval = 1;         (int = (int)mydict[iindex].shell.width; < (int)stack_outter.width; += iinterval)         {                             mydict[iindex].shell.width += 1;             mydict[iindex].shell.updatelayout();             system.threading.thread.sleep(1);                          }          mydict[iindex].shell.width = stack_outter.width - (button_width * (mydict.count - 1));     } 

mydict dictionary, shell grid attempting animate when resizing. sorry code, it's messy, code hacked when trying stuff working :)

thanks,

ash

neried web solutions

your openwindow method happening on dispatcher thread. that's thread responsible rendering, long openwindow method doesn't return, nothing gets rendered.

the proper way fix animate width property. don't have experience in starting animations code (i've used them in past things fade-in button highlight on mouse over, more done wpf), took quick read-through page, animation overview on msdn, , think you'll want this:

        doubleanimation mydoubleanimation = new doubleanimation();         mydoubleanimation.from = mydict[iindex].shell.width;         mydoubleanimation.to = stack_outter.width;         mydoubleanimation.duration = new duration(timespan.fromseconds(0.5));         mydoubleanimation.autoreverse = false;         mydoubleanimation.repeatbehavior = new repeatbehavior(1.0);          mystoryboard = new storyboard();         mystoryboard.children.add(mydoubleanimation);         storyboard.settarget(mydoubleanimation, mydict[iindex].shell);         storyboard.settargetproperty(mydoubleanimation, new propertypath(frameworkelement.widthproperty));         mystoryboard.begin(mydict[iindex].shell); 

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 -