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 - Binding Source in MediaTimeline -


i trying have mediatimeline bind uri so:

<usercontrol.resources>     <storyboard x:key="mystoryboard">         <mediatimeline storyboard.targetname="mymediaplayer"                        source="{binding mediasource}"                        repeatbehavior="forever" />     </storyboard> </usercontrol.resources>  <usercontrol.triggers>     <eventtrigger routedevent="frameworkelement.loaded">         <beginstoryboard storyboard="{staticresource mystoryboard}" />     </eventtrigger> </usercontrol.triggers>  <grid>     <mediaelement x:name="mymediaplayer" /> </grid> 

however, when this, says need "must specify uri." dispatcher exception. in viewmodel, have property like:

    public uri mediasource     {         { return _mediasource; }         set         {             if (_oscilloscopesource != value)             {                 _mediasource= value;                 onpropertychanged("mediasource");             }         }     } 

it seems though when media player loaded, doesn't read source binding. gives?

in constructor, have:

_mediasource = new uri(@"c:\somemovie.mov", urikind.absolute); 

thanks.

update
can't work shooting in dark now. moving trigger mediaelement make difference?

<mediaelement x:name="mymediaplayer">     <mediaelement.triggers>         <eventtrigger routedevent="frameworkelement.loaded">             <beginstoryboard storyboard="{staticresource mystoryboard}" />         </eventtrigger>     </mediaelement.triggers> </mediaelement> 

i tried out , works me. possible reasons can think of.

  • do have datacontext set usercontrol?
  • setting _mediasource directly won't call onpropertychanged since you're not setting clr property. set mediasource instead.
  • your mediaelement named mymediaplayer , not mymediaplayer targetname. (typo?)

except mediaelement name changed, working xaml identical yours. full code behind file

public partial class usercontrol1 : usercontrol, inotifypropertychanged {     public usercontrol1()     {         initializecomponent();         mediasource = new uri("c:\\c1.mov");         this.datacontext = this;     }      private uri _mediasource;     public uri mediasource     {                 {             return _mediasource;         }         set         {             _mediasource = value;             onpropertychanged("mediasource");         }     }      public event propertychangedeventhandler propertychanged;     private void onpropertychanged(string propertyname)     {         if (propertychanged != null)         {             propertychanged(this, new propertychangedeventargs(propertyname));         }     } } 

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 -