This is a migrated thread and some comments may be shown as answers.

WPF: add chart control inside Combobox

7 Answers 71 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Gshhar
Top achievements
Rank 1
Gshhar asked on 17 Mar 2017, 05:18 AM

So i have this model:

public class MachineNetworkAdapter
{
  public string Name { get; set; }
  public string IpAddress { get; set; }
  public static List<MachineNetworkAdapter> MachineAdapters;
}

 

So each mechine adapter have this members.
So i have this Combobox that show all my Machine Adapters:

<ComboBox
    Name="cbAdapterss"
    ItemsSource="{Binding MachineAdapters}"
    SelectionChanged="cbInterfaces_SelectionChanged"/>

 

So in this case i can see all my machine adapters with this properties.
Now i want to see also my adapters Rate in MBit/sec so i added this members:

public Series { get; set; }
  public double Rate { get; set; }

 

the member Rate is MBit/sec and the value is changing every 1 sec. the series is for the chart in order to put into the values.
So i added template with chartand now this is my Combobox:

<ComboBox
    Name="cbAdapters"
    ItemsSource="{Binding MachineAdapters}"
    SelectionChanged="cbInterfaces_SelectionChanged">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <telerik:RadCartesianChart
                x:Name="chartTemplate"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

 

So now all i can see in my Combobox is an empty chart without the other properties. So my question is how can i populate my chart and also see the other properties (Name, IPAddress).

7 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 21 Mar 2017, 02:48 PM
Hi ,

Thank you for your interest in RadChartView.

The chart is not populated because you haven't specified the axis which you are going to use and the series. You can take a look at the following resources which could help you to implement your approach.

Hope this information is helpful. Please, let us know if further questions arise. 

In addition, you set the Product tag of this thread to our old RadChart component. From the attached code snippet we can see that you are using the new chart (RadChartView) so we are changing the Product tag of this thread to RadChartView for WPF.

Regards,
Dinko
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gshhar
Top achievements
Rank 1
answered on 21 Mar 2017, 05:54 PM
I need to specify the axis and the series although if i am using and create the series in code behind ?
0
Martin Ivanov
Telerik team
answered on 24 Mar 2017, 02:16 PM
Hello Gshhar,

I prepared a small example that demonstrates how you can use the chart in the described scenario. Please give it a try and let me know if it helps. I would also recommend you to check the resource provided by Dinko. You can check Getting Started that demonstrates how to set up the chart.

About creating the series in code behind, you can do that. However, in your case this won't be very straight forward because you have the chart defined in a DataTemplate. This means that you cannot access it via code behind. In this case you could think of another approach setting the chart's properties in code. Or just define it in XAML.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gshhar
Top achievements
Rank 1
answered on 28 Mar 2017, 07:45 AM
How can i open this ? it missing the .sln file.
0
Martin Ivanov
Telerik team
answered on 28 Mar 2017, 08:09 AM
Hello,

You can open the WpfApplication1.csproj file with Visual Studio.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gshhar
Top achievements
Rank 1
answered on 17 Oct 2017, 12:36 PM
Ok i can see the chart inside the Combo-Box but the Name and Ip Address is missing.
0
Martin Ivanov
Telerik team
answered on 18 Oct 2017, 10:49 AM
Hello Gshhar,

This is because the chart doesn't support showing any additional information except the plotted data. To show the Name and IpAddress and your side you will need to think on how you want to visualize them and then implement this with custom code.

A possible approach for you could be use a legend, this will allow you to take advantage of the chart's RadLegend support.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Chart
Asked by
Gshhar
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Gshhar
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or