Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi! Please Help

I am trying to bind a silverlight treemap to ADO.net Entity Data Model using a SQL database. I can get the Data to load into a datagrid. I cant however get the Treemap to load the data. Where have I gone wrong?
XML
<riaControls:DomainDataSource Name="domainDataSource1" QueryName="GetOverviews" AutoLoad="True">
            <riaControls:DomainDataSource.DomainContext>
                <ds:DataDomainContext />
            </riaControls:DomainDataSource.DomainContext>
            <riaControls:DomainDataSource.FilterDescriptors>
                <riaControls:FilterDescriptor PropertyPath="BU" Operator="IsEqualTo" Value="Utilities" />
            </riaControls:DomainDataSource.FilterDescriptors>
        </riaControls:DomainDataSource>

<StackPanel Grid.Row="1">
                <datavis:TreeMap x:Name="TreemapControl">

                <datavis:TreeMap.Interpolators>
                    <datavis:SolidColorBrushInterpolator TargetName="itemContainer" TargetProperty="Background"
                                                       DataRangeBinding="{Binding M_Status}" From="Red" To="Green" />
                </datavis:TreeMap.Interpolators>

                <datavis:TreeMap.ItemDefinition>
                        <datavis:TreeMapItemDefinition   ItemsSource="{Binding ElementName=domainDataSource1, Path=Data}" ValuePath="{Binding IO}">

                        <DataTemplate>
                            <Border x:Name="itemContainer" Background = "red"  BorderBrush="red" BorderThickness="1" >
                                <TextBlock  VerticalAlignment="Center" TextWrapping="Wrap"/>
                            </Border>
                        </DataTemplate>

                    </datavis:TreeMapItemDefinition>
                </datavis:TreeMap.ItemDefinition>

            </datavis:TreeMap>
            </StackPanel>
        </Grid>
  </Grid>
</UserControl>
Posted
Updated 9-Jan-12 4:18am
v3
Comments
Matt988 17-Jan-12 1:34am    
Thanks for the help. I managed to get the binding working with using ItemsSource="{Binding Data,ElementName=domainDataSource1}" and placing Itemssource in ItemDefinition.

I now have a problem trying to group the data together. I am using data from one table on a SQL database. The data therefore has no heirarchy defined for it and therefore displays in the treemap as each individual entry. Is it possible to define the heirarchy of the data in the code-behind file, without changing the database?

1 solution

you are using silverlight toolkit treemap control, I guess something is wrong with
HTML
<datavis:TreeMapItemDefinition   ItemsSource="{Binding ElementName=domainDataSource1, Path=Data}" ValuePath="{Binding IO}">
piece of code check all bindings. Are you getting the values for these properties from database. Debug the application and check the values as it is very difficult to say with out seeing all the code.

you can refer to Silverlight toolkit 4 source code for displaying treemap.

for further queries comment here!

hope it helps :)
 
Share this answer
 
v2
Comments
Matt988 17-Jan-12 1:36am    
Thanks for the help. I managed to get the binding working with using ItemsSource="{Binding Data,ElementName=domainDataSource1}" and placing Itemssource in ItemDefinition. I now have a problem trying to group the data together. I am using data from one table on a SQL database. The data therefore has no heirarchy defined for it and therefore displays in the treemap as each individual entry. Is it possible to define the heirarchy of the data in the code-behind file, without changing the database?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900