Just add this to the button with the id="22" :
Code:
<onclick>close</onclick>
It's the clear button. Once it's triggered, the dialog is going to be closed.
You also can add this to the header of the myplaylist.xml
Code:
<onload condition="!Integer.IsGreater(Container(50).NumItems,0)">close</onload>
This will force close the window once is going to be openend (by the user, or automatically) if the list is empty.
To bypass animation glitches (depends on the used skin), you should also group all elements into a main group
Code:
<control type="group">
<visible>Integer.IsGreater(Container(50).NumItems,0)</visible>
.....
</control>
Example:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">50</defaultcontrol>
<onload condition="!Integer.IsGreater(Container(50).NumItems,0)">close</onload>
<include>PropertyIncludes</include>
<views>50</views>
<controls>
<control type="group">
<visible>Integer.IsGreater(Container(50).NumItems,0)</visible>
<!-- Content -->
<include condition="Window.IsVisible(videoplaylist)">VideoPlaylistLayout</include>
<include condition="Window.IsVisible(musicplaylist)">MusicPlaylistLayout</include>
</control>
</controls>
</window>