1
<Popup 
    Name="loadingAnimation"
    PlacementTarget="{Binding ElementName=m_mainWindow}"
    Placement="Center"
    StaysOpen="True"
    IsOpen="True"
    Height="200"
    Width="200">
    <MediaElement 
        Height="200"
        Width="200"
        Margin="-100,-72,0,0"
        HorizontalAlignment="Left"
        VerticalAlignment="Top"
        Source="/Images/Loading.gif" 
        LoadedBehavior="Play"/>
</Popup>

The code dose show the popup area in black, but doesn't play gif. If I set AllowsTransparency="True", I cannot see anything. How to display gif in a popup?

  • [This post](https://stackoverflow.com/q/34386658/1136211) indicates that MediaElement doesn't work with resource files. Try to set the GIF file's `Build Action` to `Content`, and `Copy to Output Directory` to something else than `Do not copy`. – Clemens Oct 25 '18 at 13:26
  • @Clemens Thank for your reply. I did set Build Action to Embed resource, and I set copy if new. I changed build action to content and it still not working... –  Oct 25 '18 at 13:34
  • Did you also remove the leading slash from the relative path? Like `Source="Images/Loading.gif"` – Clemens Oct 25 '18 at 13:49
  • When you to set the build action of your loading.gif to `Content` it should work as you expect. See this link: https://stackoverflow.com/a/49883316/7808992 – fussel Oct 25 '18 at 15:42

0 Answers0