The sample looks well in Expression Blend, but it's not possible to see any charts after it was compiled with Visual Studio.
Maybe there is a problem with the data binding path.
Does anyone has an idea?
Hi,
XML data source:
<?xml version="1.0" encoding="UTF-8"?><dataroot><Table1><ID>1</ID><Name>John</Name><Price>53</Price></Table1><Table1><ID>2</ID><Name>Ed</Name><Price>68</Price></Table1><Table1><ID>3</ID><Name>David</Name><Price>29</Price></Table1></dataroot>
xaml:
<Window.Resources> <XmlDataProvider x:Key="PatientData" Source="C:\TFS\Table1.xml" /></Window.Resources>
<igCA:XamChart x:Name="Chart1"> <igCA:XamChart.Series> <igCA:Series Label="Patient Height" ChartType="Column" DataSource="{Binding Mode=Default, Source={StaticResource PatientData}, XPath=/dataroot}" DataMapping="Value=Price; Label=Name" /> </igCA:XamChart.Series></igCA:XamChart>
Thanks,GoranS
thank you very much for the answer.
Now it works fine. But is there a possibility to use relative paths?
When I use a absolute path so I have to install the application always in the same directory or set a new path before the installation.
When I use a relative path so it doesn't matter where the application was installed.
Thanks,
Juergen
GoranS
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
provider.Source = new Uri(path + "//Table1.xml",UriKind.Absolute);
}
GoranS, thank you for the information about relative paths.
Well, I mean the infragistics sample (xamlFeatureBrowser/Samples/XamChart/Data_Bind_XML.xaml).
The xml file is added to the project (xamlFeatureBrowser/datasources/Orders.xml).
Cause I'm using a "non english" operating systems I adapted the code in a few lines. (http://forums.infragistics.com/forums/t/1141.aspx)
It is not possible to see the charts neither with...
<XmlDataProvider x:Key="SampleDataDS" Source="..\..\datasources\Orders.xml"/>
...nor with...
<XmlDataProvider x:Key="SampleDataDS" Source="Orders.xml"/>
...but it works fine with an absolute path:
<XmlDataProvider x:Key="SampleDataDS" Source="C:\.<user_specific_path>\Infragistics\NetAdvantage for WPF 2007 Vol. 2\Samples\xamFeatureBrowser\datasources\Orders.xml"/>
Is that the only way to run that sample?
Juergen, the easiest way is to add your xml file to the project using Solution explorer. Use Add->Existing item and add xml file to the project. Then you need only this in your xaml file:
<Window.Resources>
<XmlDataProvider x:Key="PatientData" Source="Table1.xml" />
</Window.Resources>
If you don't want to add xaml file to the project, you will find more info about relative paths here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2737509&SiteID=1