locked
Binding a Sharepoint Multiple Choice Field to a Listview RRS feed

  • Question

  • I have a sharepoint List which I am connecting to through a service reference. It has two columns which I need access to. The standard title column and a multiple choice column called Year.

    I understand how to bind a text string into a listview, but how do you bind the values of a choice field from sharepoint onto a checkbox/some other visual display?

    I have copied in a basic version of what I am currently doing for binding the title column. This is currently in a Windows 8 app.


    // XAML code for listview
    <ListView Name="Listitems" Margin="62,223,0,0">
     <ListView.ItemTemplate>
      <DataTemplate>
       <StackPanel Orientation="Horizontal">
        <TextBlock Height="21" TextWrapping="Wrap" Text="{Binding Title}" Width="138" FontSize="14"/>
       </StackPanel>
      </DataTemplate>
     </ListView.ItemTemplate>
    </ListView>


    //LoadList Code for listview population
    ExternalDataContext SharepointContext;
    private DataServiceCollection<TestListItem> _Collection;
    private void LoadListItems()
    {
     var SharepointListItems = new SharepointContext("server address");
     SharepointListItems.Credentials = new (NetworkCredential("credentials");
     _Collection = new DataServiceCollection<TestListItem>(SharepointListItems);
     Listitems.ItemSource = _Collection_LoadCompleted;
     var query = (from i in SharepointListItems.TestList select i);
     _Collection.LoadAsync(query);
    }

    Tuesday, February 26, 2013 5:11 AM