I'm getting a weird error when I'm trying to bind a list of strings to the LongListMultiSelector. The values I want to assign are from the IsolatedStorage.GetFileNames("Path\\*");
XAML-Code: The Template
<DataTemplate x:Key="plItemTemplate">
<Grid Margin="{StaticResource PhoneTouchTargetOverhang}">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu Name="conPlMgr" Opened="conPlMgr_Opened" Closed="conPlMgr_Closed">
<toolkit:MenuItem Name="mnuPlaylist" Header="{Binding LocalizedResources.AddToPlaylist, Source={StaticResource LocalizedStrings}}" Click="mnuPlaylist_Click"/>
<toolkit:MenuItem Name="mnuFav" Header="{Binding LocalizedResources.AddToFav, Source={StaticResource LocalizedStrings}}" Click="mnuFav_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<TextBlock Name="cmdPlItem" Tap="cmdPlItem_Tap" FontFamily="Segoe UI Symbol" TextWrapping="Wrap" Margin="5,0,5,5" FontSize="24"/>
</Grid>
</DataTemplate>
The LongListMultiSelector
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid Style="{StaticResource LongListLastItemMargin}">
<toolkit:LongListMultiSelector
Name="lstPlaylists"
Style="{StaticResource LongListMultiselectorProps}"
ItemTemplate="{StaticResource plItemTemplate}"
ItemsSource="{Binding Instance.GetPlaylists,Source={StaticResource PlaylistManager}}"
IsSelectionEnabledChanged="lstPlaylists_IsSelectionEnabledChanged"/>
</Grid>
</Grid>
The List:
public List<string> GetPlaylists
{
get { return isoStore.GetFileNames("Playlists\\*").ToList(); }
}
And this is the error message I get:
Message: Error HRESULT E_FAIL has been returned from a call to a COM component. StackTrace: Is handled?: False e.ToString()System.Windows.ApplicationUnhandledExceptionEventArgs CompleteStuff: MS.Internal.WrappedException: Error HRESULT E_FAIL has been returned from a call to a COM component. ---> System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component. at MS.Internal.XcpImports.CheckHResult(UInt32 hr) at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize) at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight) --- End of inner exception stack trace ---
I don't get what's the problem here, there should be no problem with the values, they're returned correctly. I've binged and googled so much but still weren't able to find a solution for this, it's so depressing since this is such a blocker for a new feature...
UPDATE
Well~ I don't know but it works now.
If I do this: <TextBlock Text={Binding} /> it works if I set the values in the constructor.