0

初めての本当の WPF アドベンチャーに苦労しています。

私のXAMLは次のとおりです。

    <ItemsControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="ImageList" x:FieldModifier="private" ItemsSource="{Binding Source= images }">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel></StackPanel>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <!-- The Image binding -->
            <TextBox Text="{Binding Key}" MouseDoubleClick="Control_OnMouseDoubleClick"></TextBox>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

私のC#は:

            var ll = new LocalDataHandler();

        var data = ll.FetchContentByContentType(
            new string[] {"Movie", "Television"}, 0);

        List<KeyValuePair<string, string>> images = data.Select(
            contentItem => new KeyValuePair<string, string>(contentItem.ContentName,
                                                            contentItem.ContentId.ToString(
                                                                CultureInfo.InvariantCulture))).ToList();
        ImageList.ItemsSource = images;

ImageList には必要なものがすべて入力されていますが、何らかの理由でフォームに何も表示されません。

4

1 に答える 1

0

バインディングモードをTeextBoxのOneWayに設定してみてください

<TextBox Text="{Binding Key, Mode=OneWay}" MouseDoubleClick="Control_OnMouseDoubleClick"></TextBox>
于 2013-09-25T14:10:14.733 に答える