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

  • SEARCH
  • Home
  • 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 3392118
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:52:58+00:00 2026-05-18T03:52:58+00:00

I have been using DataVisualization.Charting.Chart to produce few charts. Everything works very well, until

  • 0

I have been using DataVisualization.Charting.Chart to produce few charts. Everything works very well, until when I put the same inside a DataTemplate of a ListBox.

Inside the ListBox, the Chart data shows up properly, but the Legends are not showing.

I have been using Normal LineSeries chart. Here is the code :

<ListBox Style="{DynamicResource listBasic}"
                         FontSize="12"
                         FontWeight="Normal"
                         ItemsSource="{Binding PsychrometricLogs}">
                    <ListBox.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.ContainerStyle>
                                <Style TargetType="{x:Type GroupItem}">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate>
                                                <Expander Header="{Binding Name}"
                                                          FontFamily="Calibri"
                                                          FontSize="18"
                                                          Foreground="{DynamicResource defForegroundBrush}"
                                                          IsExpanded="True">
                                                    <ItemsPresenter />
                                                </Expander>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </GroupStyle.ContainerStyle>
                        </GroupStyle>
                    </ListBox.GroupStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>

                                <Grid>
                                    <Border CornerRadius="5"
                                            Margin="2,5,2,5"
                                            Opacity=".3"
                                            Background="#000000" />
                                    <DockPanel>
                                    <chart:Chart Title="{Binding DisplayName}"
                                                 FontSize="14"
                                                 DockPanel.Dock="Top"
                                                 LegendTitle="Legends"
                                                 Margin="20,15,20,5"
                                                 Foreground="#000000"
                                                 DataContext="{Binding Logs}">
                                        <chart:LineSeries Title="Temperature"
                                                          AnimationSequence="FirstToLast"
                                                          IndependentValueBinding="{Binding TimeStamp}"
                                                          DependentValueBinding="{Binding Temparature}"
                                                          ItemsSource="{Binding}" />
                                        <chart:LineSeries Title="Relative Humidity"
                                                          AnimationSequence="FirstToLast"
                                                          IndependentValueBinding="{Binding TimeStamp}"
                                                          DependentValueBinding="{Binding RelativeHumidity}"
                                                          ItemsSource="{Binding}" />
                                        <chart:LineSeries Title="Grains Per Pound"
                                                          AnimationSequence="FirstToLast"
                                                          IndependentValueBinding="{Binding TimeStamp}"
                                                          DependentValueBinding="{Binding GrainsPerPound}"
                                                          ItemsSource="{Binding}" />
                                        <chart:LineSeries Title="Grains Depression"
                                                          AnimationSequence="FirstToLast"
                                                          IndependentValueBinding="{Binding TimeStamp}"
                                                          DependentValueBinding="{Binding GrainsDepression}"
                                                          ItemsSource="{Binding}" />
                                    </chart:Chart>
                                    <ListView ItemsSource="{Binding Logs}"
                                              DockPanel.Dock="Top"
                                              Margin="5,0,5,5"
                                              Padding="0">
                                        <ListView.View>
                                            <GridView AllowsColumnReorder="True">
                                                <GridViewColumn Header="Time Stamp"
                                                                DisplayMemberBinding="{Binding TimeStamp}" />
                                                <GridViewColumn Header="Temperature"
                                                                DisplayMemberBinding="{Binding Temparature}" />
                                                <GridViewColumn Header="RH"
                                                                DisplayMemberBinding="{Binding RelativeHumidity}" />
                                                <GridViewColumn Header="GPP"
                                                                DisplayMemberBinding="{Binding GrainsPerPound}" />
                                                <GridViewColumn Header="GD"
                                                                DisplayMemberBinding="{Binding GrainsDepression}" />
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                    </DockPanel>    
                                </Grid>

                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

You can see, I have placed one ListView and a Chart. The ListView shows data properly as well as the chart. But the Legends does not show up.

I have already tried to put the same chart outside the ListBox and it shows up Legends correctly but not inside the DataTemplate.

It would be helpful if somebody tell me where I am wrong in this.

  • 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-05-18T03:52:59+00:00Added an answer on May 18, 2026 at 3:52 am

    I suspect the problem is in your listBasic style. Your XAML works perfectly for me. I just pasted it into a new window and added the following in InitializeComponent():

      var rand = new Random();
      DataContext = new { PsychrometricLogs =
        from i in Enumerable.Range(0, 5)
        select new
        {
          Logs =
            from j in Enumerable.Range(0, 10)
            select new
            {
              TimeStamp = rand.Next(10),
              Temparature = (decimal)rand.Next(100),
              RelativeHumidity = (decimal)rand.Next(100),
              GrainsPerPound = (decimal)rand.Next(10),
              GrainsDepression = (decimal)rand.Next(10),
            }
        }};
    

    For additional help, please show us the styles you are using and let us know your WPFToolkit version.

    By the way, you mis-spelled “Temperature”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using MySQLi and for the most part finding it very useful,
I have been using Mobclix in my application and haven't experienced any issues until
I have been using the ASP.NET chart controls for a while on win2k3 (32bit)
I have been using the Scanner object to take in input until now and
I am using DataVisualization.Charting.Chart extensively, and for the most part it is working. However,
I have been using slim, and suddenly noticed that it escapes everything by default.
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I

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.