私は、SharePoint からのリストを表示する Windows ガジェットに取り組んでいます。コード ビハインドは正常に機能し、sharepoint からデータを収集します。私のxamlコードはリストボックスにリストを表示する必要がありますが、それをバインドした方法では、データが1行ごとに最初の項目だけで表示されます。理由がわからない。
これは私のxmlコードです
<Page x:Class="TipsList.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Page1" Height="350" Width="525">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <ListBox Name="ListboxTips" Width="Auto" ItemsSource="{Binding StateTitle}" />
        <StackPanel Grid.Column="1">
            <Button Click="OnLoad">_Load</Button>
        </StackPanel>
    </Grid>
</Page>
これは私のコードビハインドです:
        //The  Url
        siteUrl = "http://site/SandBox";
        //The Site Context using ClientContext class
        //This will create a Client connection to Web Application
        clientContext = new SPSClient.ClientContext(siteUrl);
        //The Web Site to Open
        clientWeb = clientContext.Web;
        var salesInfoList = clientContext.Web.Lists.GetByTitle("Tips");
        //Define the CAMLQuery this will be used to Query to the List
        SPSClient.CamlQuery Query = new SPSClient.CamlQuery();
        SPSClient.ListItemCollection listData = salesInfoList.GetItems(Query);
        //Now Execute the Query
        var queryResultSaleListItems = clientContext.LoadQuery(listData);
        clientContext.ExecuteQuery();
        //Read the Data into the Object
        var TipsList = from Sales in queryResultSaleListItems
                        select Sales;
        ObservableCollection<Tips> colTips = new ObservableCollection<Tips>();
        //Read Every List Item and Display Data into the DataGrid
        foreach (SPSClient.ListItem item in TipsList)
        {
            var tips = new Tips();
            tips.StateTitle = item.FieldValues.Values.ElementAt(2).ToString();
            tips.ProductName = item.FieldValues.Values.ElementAt(4).ToString();
            tips.Quantity = item.FieldValues.Values.ElementAt(5).ToString();
            colTips.Add(tips);
        }
        ListboxTips.DataContext = colTips;
    }
    catch (Exception ex)
    {
        // Log error (including InnerExceptions!)
        // Handle exception
    }
}
ご協力いただきありがとうございます、