Good day All,
I have a XamDataChart inside a XamTileManager to display employee statistics, specifically using a graph.
I am binding to a object populated via a WCF service, but nothing is displayed on the graphs.
I have set the DataContext of the Tile Manager, and the data chart does get bound to the data, but nothing is being displayed.
I am also attaching a snippet containing the XAML code (the binding object "Provider.WorkBenchPerformanceStatistics.WorkbenchLAPerformance" is a reference to an IList of a type received from a WCF service, also the items in the textblocks are displayed without issue):
<ig:XamTileManager Width="Auto" Name="xtmLegalWallboardBottom" Margin="0,522,12,-427" ItemsSource="{Binding Path=Provider.WorkBenchPerformanceStatistics.WorkbenchLAPerformance, Mode=TwoWay}"> <ig:XamTileManager.ItemTemplateMinimized> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplateMinimized> <ig:XamTileManager.ItemTemplate> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplate> <ig:XamTileManager.ItemTemplateMinimizedExpanded> <DataTemplate> <TextBlock Name="tbName" Text="{Binding StaffFullName}" /> </DataTemplate> </ig:XamTileManager.ItemTemplateMinimizedExpanded> <ig:XamTileManager.ItemTemplateMaximized> <DataTemplate> <Grid Name="grdWorkbench" Width="Auto" Height="Auto"> <ig:XamDataChart Name="xdcWorkbenchCounts" HorizontalZoomable="True" HorizontalZoombarVisibility="Collapsed" VerticalZoomable="True" VerticalZoombarVisibility="Collapsed" DataContext="{Binding}" Visibility="Visible" Height="100" Width="400" VerticalAlignment="Top"> <ig:XamDataChart.Axes> <ig:CategoryXAxis x:Name="BarXAxisCases" Width="Auto" Label="{}{StaffFullName}" LabelSettings="{StaticResource AxisLabelSettings}" /> <ig:NumericYAxis x:Name="BarYAxisCases" Width="Auto" Margin="5" Label="{}{}" LabelSettings="{StaticResource AxisLabelSettings2}" /> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:ColumnSeries Title="Open Case Count" ValueMemberPath="OpenCaseCount" XAxis="{Binding ElementName=BarXAxisCases}" YAxis="{Binding ElementName=BarYAxisCases}"> <ig:ColumnSeries.Brush> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FFf79036" /> <GradientStop Color="#FFe3720c" Offset="1" /> </LinearGradientBrush> </ig:ColumnSeries.Brush> </ig:ColumnSeries> <ig:ColumnSeries Title="Converted Case Count" ValueMemberPath="ConvertedCaseCount" XAxis="{Binding ElementName=BarXAxisCases}" YAxis="{Binding ElementName=BarYAxisCases}"> <ig:ColumnSeries.Brush> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FFf79036" /> <GradientStop Color="#FFe3720c" Offset="1" /> </LinearGradientBrush> </ig:ColumnSeries.Brush> </ig:ColumnSeries> </ig:XamDataChart.Series> </ig:XamDataChart> </Grid> </DataTemplate> </ig:XamTileManager.ItemTemplateMaximized> </ig:XamTileManager>
Hi
I had a similar issue and in my case I found that XamPieChart did bind properly to any object when it was placed inside a DataTemplate tags of the XamTileManager.
To illustrate;
The following code does NOT work;
<DataTemplate x:Key="NormalTemplate">
<ig:XamPieChart ItemsSource="{Binding Path=Products}" ValueMemberPath="Price" LabelMemberPath="ProductName"/>
</DataTemplate>
However the following works;
<ig:XamPieChart ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type Window}}, Path=Products}" ValueMemberPath="Price" LabelMemberPath="ProductName"/>
Hope this helps
Regards
Jav Ainesaz
Hello Jav,
Thank you for sharing this. I believe that the other community members may benefit from this as well.
Thanks again.