Creating Lists of Media Items

You can use the CreateFileListHelper class and ICreateFileListHelper interface to gather lists of items from the media libraries (pictures, music, videos, and recorded TV) and provide them to an MCML-based application. Such applications include, but are not limited to, CD/DVD burning applications. Applications can add and remove items from these lists, and open lists that were previously created.

The following example shows how to create a list and display the items that were selected. 

<Mcml xmlns="https://schemas.microsoft.com/2008/mcml" 
      xmlns:cor="assembly://MSCorLib/System"
      xmlns:mce="assembly://Microsoft.MediaCenter/Microsoft.MediaCenter.Hosting" 
      xmlns:lm="assembly://Microsoft.MediaCenter/Microsoft.MediaCenter.ListMaker"
      xmlns:btn="file://ControlsSimpleButton.mcml"
      xmlns:me="Me" >

  <UI Name="Default">
    <Locals>
      <mce:PageSession Name="Session" PageSession="$Required"/>
      <mce:AddInHost Name="MCEHost"/>
      <lm:InitialListType Name="ListType" InitialListType="LastSaved"/>
      <lm:CreateFileListHelper Name="MyCallableListMakerDelegate"/>
      <Command Name="CallListMakerCommand" Description="Create List"/>
      <Command Name="ResetCommand" Description="Reset List"/>

    </Locals>
    <Rules>
      <Binding Source="[MyCallableListMakerDelegate.FileList]" Target="[MyList.MySource]" />
      <Changed Source="[CallListMakerCommand.Invoked]">
        <Actions>
          <Invoke Target="[MCEHost.MediaCenterEnvironment.CreateFileList]"
                  createFileListHelper="[MyCallableListMakerDelegate]" initialListType="[ListType]" 
                  InvokePolicy="Synchronous" ExclusiveApply="false"/>
          <Set Target="[MyList.Indent.Value]" Value="0"/>
        </Actions>
      </Changed>
    </Rules>

    <Content>
      <Panel Layout="VerticalFlow">
        <Children>
          <btn:SimpleButton Command="[CallListMakerCommand]"/>
          <me:ShowList Name="MyList" MySource="[MyCallableListMakerDelegate.FileList]" />
        </Children>
      </Panel>
    </Content>
  </UI>

  <UI Name="ShowList">
    <Properties>
      <lm:ListMakerList Name="MySource" lm:ListMakerList="null"/>
      <IntRangedValue Name="Indent" Value="0" Step="20" />
    </Properties>
    <Locals>
      <Inset Name="TextMargins" Inset="0,0,0,0" />
    </Locals>
    <Rules>
      <Default Target="[TextMargins.Left]" Value="[Indent.Value]" />
      <Binding Target="[MyRepeater.Source]" Source="[MySource]" />
      <Changed Source="[MySource]">
        <Actions>
          <Invoke Target="[Indent.NextValue]" />
        </Actions>
      </Changed>
    </Rules>
    <Content>
      <Repeater Name="MyRepeater" Source="[MySource]">
        <Layout>
          <FlowLayout Orientation="Vertical" Spacing="10,0"/>
        </Layout>
        <ContentSelectors>
          <TypeSelector Type="cor:Object" ContentName="ListDetails"/>
        </ContentSelectors>
      </Repeater>
    </Content>

    <Content Name="ListDetails">
      <Panel Layout="HorizontalFlow" Margins="[TextMargins]">
        <Children>
          <Text Color="white" Content="File name: " Font="Tahoma,12" Margins="[TextMargins]" />
          <Text Color="white" Content="[RepeatedItem!lm:ListMakerItem.FileName]" Font="Tahoma,12" />
        </Children>
      </Panel>
    </Content>
  </UI>

</Mcml>

See Also