In XAML you can set the value to the properties like this:
<MediaElement x:Name="player"
LoadedBehavior="Manual"
UnloadedBehavior="Stop" ... />
Or using code behind:
player.LoadedBehavior = MediaState.Manual;
player.UnloadedBehavior = MediaState.Stop;