Posts Tagged ‘ Uri ’

How to Access Resources in an Assembly

new Uri("SilverlightApplication1;component/MyImage.png", UriKind.Relative)

Cross linked styles can be access in the same way!

            <ResourceDictionary Source="/SharedThemeAssembly;component/MyStyles.xaml"/>
            ...other ResourceDictionaries to merge in...

Playing Sound in Silverlight

Placing a media element in Blend and controling it’s playback is pretty simple but sometimes you just want to do it all in code.

using System.Windows.Resources;

MediaElement m = new MediaElement();
StreamResourceInfo sri = Application.GetResourceStream(new Uri("HBO_Usercontrols_XAML;component/Takeofff.mp3", UriKind.Relative));
VisualStateManager.GoToState(this, "ShowButtons", true);