This project has moved. For the latest updates, please go here.

Further development

Developer
Nov 19, 2008 at 1:50 PM
Hi. Many thanks for this control, it provided me with a great place to start. I have made a number of modifications you may be interested in adopting, or I can just send you my version of the code.

* I have refactored SimplePlayer to inherit from Control rather than UserControl so that it can use the Parts and States model. I then moved your template to themes/generic.xaml and began constructing my own. The SimplePlayer class now looks something like this...
    [TemplateVisualState(Name="Playing", GroupName="MediaStates")]
[TemplateVisualState(Name = "Paused", GroupName = "MediaStates")]
[TemplateVisualState(Name = "Stopped", GroupName = "MediaStates")]
[TemplateVisualState(Name = "Error", GroupName = "MediaStates")]
...
public class SimplePlayer : Control
{
        void mediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(this, AudioElement.CurrentState.ToString(), true);        
        }
...
}
Coordinator
Nov 20, 2008 at 7:28 AM
sounds great, email me the code and I'll see if I can get your changes merged in.

Mark
Developer
Nov 20, 2008 at 3:05 PM
Will do, I want to polish the code up a bit and remove any redundancies first, as well as provide an example of a customised template. If you're happy with the direction I'm going in, then feel free to add me as a developer on the project.

I've tried not to make too many changes to your control template, though I have made a couple of modifications.

* inlined AnimatedSpeaker and ProgressSlider as this should make the ControlTemplate easier to customize
* Replaced explicit control over storyboard animations in code behind with state transitions in XAML
* replaced rightSection ( the pause/play control ) with a templated ToggleButton

I also want to add some new properties to make it possible to do some degree of customisation without replacing the entire ControlTemplate.

Regards,
Andrew.
Coordinator
Nov 21, 2008 at 10:01 AM
hi Andrew, I've added you as a developer. Looking forward to seeing what you've done with it.