tags:

views:

4

answers:

0

Hello,

I try to create a DetailRow in a WPF Toolkit DataGrid. In this DetailRow I would like to show a ColumnChart. For the DataBinding, I created a ObservableCollection with the following members:

int counter;
string text;
double dvalue1;
double dvalue2;
double dvalue3;
string imagePath;
bool loadImage;
ObservableCollection<Chart3Details> detailColl = new ObservableCollection<Chart3Details>();
string detailsText;

This means, some of the members will be bind to the datagrid and the detailColl has the data for the RowDetail.

The detailColl resp. Chart3Details has the following member:

class Chart3Details
{
    int xVal;
    double yVal;
    DateTime date;
    ...
}

All the data in the DataGrid are perfectly binded, but the ChartData in the RowDetail not. I use the following XAML for the RowDetails:

<DataTemplate x:Key="RowDetailsTemplate1">
    <Grid TextBlock.Foreground="White"
          TextBlock.FontSize="14"
          TextBlock.FontStyle="Oblique"
          Background="DarkSlateBlue">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <cT:Chart Grid.Column="0"
                  HorizontalAlignment="Stretch" 
                  Margin="12" Name="detailChart" 
                  VerticalAlignment="Stretch" 
                  Width="Auto" Height="Auto" 
                  HorizontalContentAlignment="Right" 
                  VerticalContentAlignment="Stretch" 
                  Focusable="True"
                  DataContext="{Binding Path=DetailsCollection}">
            <cT:ColumnSeries IndependentValueBinding="{Binding Path=XVal}"
                         DependentValueBinding="{Binding Path=YVal}">                    
            </cT:ColumnSeries>
        </cT:Chart>
        <TextBlock Text="{Binding DetailsText}" Grid.Column="1"/>
    </Grid>        
</DataTemplate>

The result is a DataGrid with a DetailRow, in the first column one can see a empty chart and in the second column some data.

Do you have some tips for me? Thanks.

Regards, TM