Further development

Nov 19, 2008 at 12: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);        
Nov 20, 2008 at 6:28 AM
sounds great, email me the code and I'll see if I can get your changes merged in.

Nov 20, 2008 at 2: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.

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