Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:06:56+00:00 2026-06-02T03:06:56+00:00

I am binding data that I receive from a WCF weather service to a

  • 0

I am binding data that I receive from a WCF weather service to a datagrid in silverlight. I get a return of a 7 day forecast. The problem I am having is that the return is a collection and in this collection is Temperature and Probability of Precipitation which are another level deep. In Temperature there is High and Low and then Probability of Precipitation has Daytime and Nighttime.

namespace MyProject
{
public partial class MainPage : UserControl
{

    WeatherSoapClient weatherClient = new WeatherSoapClient();

    public MainPage()
    {
        InitializeComponent();

        weatherClient.GetCityWeatherByZIPCompleted += new EventHandler<GetCityWeatherByZIPCompletedEventArgs>(weatherClient_GetCityWeatherByZIPCompleted);
    }

This is where I am setting the datagrid’s source to the Forecast Collection.

    void weatherClient_GetCityForecastByZIPCompleted(object sender, GetCityForecastByZIPCompletedEventArgs e)
    {
        this.dataGrid1.ItemsSource = e.Result.ForecastResult;

    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        weatherClient.GetCityForecastByZIPAsync(inputZip.Text);
    }
}
}

And the results that I get in the datagrid look like this:
https://i.stack.imgur.com/9W67v.jpg

As you can see under Temperature and POP that is not what I would want displayed. Being new to C# I have had a difficult time getting to the point I am at. Now someone suggested making a custom converter to drill down deeper. I am unsure of how to do this. Any help would be greatly appreciated. Hopefully I show everything you need to see.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:06:58+00:00Added an answer on June 2, 2026 at 3:06 am

    You need to set AutoGenerateColumns to False on the data grid, and then define the column types yourself (plenty of information about how to do this on the internet).

    For the first few columns, DataGridTextColumn is fine.

    For the last two, you want to use a DataGridTemplateColumn. In the DataTemplate for the column, you can put two TextBlocks, each binding to a different property.

    For example:

    <data:DataGrid AutoGenerateColumns="False">
        <data:DataGrid.Columns>
    
          <data:DataGridTextColumn Header="Date"
                                   Binding="{Binding Date}" />
    
          <data:DataGridTextColumn Header="ID"
                                   Binding="{Binding WeatherID}" />
    
          <data:DataGridTemplateColumn Header="Temperature">
            <data:DataGridTemplateColumn.CellTemplate>
              <DataTemplate>
                 <StackPanel>
                   <TextBlock Text="{Binding Temperatures.High}" />
                   <TextBlock Text="{Binding Temperatures.Low}" />
                 </StackPanel>
              </DataTemplate>
            </data:DataGridTemplateColumn.CellTemplate>
          </data:DataGridTemplateColumn>
        </data:DataGrid.Columns>
    </data:DataGrid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a WCF service that will need to receive client credentials, and maintain
My WPF application should receive data from pipe via WCF: I'm new to MVVM
I have an ScrollViewer that I am trying to do data binding on the
I have a BindingSource that I'm using in winforms data binding and I'd like
I've got a WCF service that I've written in C# which passes to the
I've got a C# WCF service that passes a collection of instantiated .Net objects
I'm making a call to a WCF service but I get a CommunicationException on
I have a DataGridView that displays data from a MS Access database. I'm using
I need to pass more than 64kb of data through the WCF service. To
I have a application which uses socket connection to send and receive data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.