Home:ALL Converter>Take a snapshot of video in mediaelement without violating MVVM pattern

Take a snapshot of video in mediaelement without violating MVVM pattern

Ask Time:2015-07-10T15:06:36         Author:somu

Json Formatter

I need to take a snapshot of video playing in MediaElement.

Below link explains how we can achieve this.

http://www.thomasclaudiushuber.com/blog/2008/04/06/take-snapshots-of-videos-with-wpf/

But how to do it without violating MVVM pattern.

Author:somu,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31334553/take-a-snapshot-of-video-in-mediaelement-without-violating-mvvm-pattern
Maximus :

<Button Command=\"{Binding TakeSnapshotCommand}\" \nCommandParameter=\"{Binding ElementName=media}\"/>\n\n\nWhere TakeSnapshotCommand is a class implementing ICommand like RelayCommand. Additionaly you send parameter T, in this case T is MediaElement so you will have following declaration. \n\nprivate RelayCommand<MediaElement> _takeSnapshotCommand;\npublic RelayCommand<MediaElement> TakeSnapshotCommand\n{\nget{ return _takeSnapshotCommand ??(_takeSnapshotCommand = new RelayCommand<MediaElement>(YourMethodTakingMediaElementAsParameter));}\n}\n",
2015-07-10T07:13:38
yy