0

I am trying to create a graph similar to this one here

I have xaml code like this:

<Border Grid.Row="1" Margin="0 4 0 0" Background="White" BorderBrush="#FFD6D4D4" BorderThickness="0 0 1 1">
            <Grid>
                <Border BorderThickness="1 1 0 0" BorderBrush="#D6D6D6" />

                <telerik:RadDiagram x:Name="diagram" GraphSource="{Binding GraphSource}"
                            ScrollViewer.HorizontalScrollBarVisibility="Visible"
                            ScrollViewer.VerticalScrollBarVisibility="Visible"
                            Zoom="{Binding ZoomFactor, Mode=TwoWay, Source={StaticResource repGpDataInstance}}" Height="800" />
            </Grid>
        </Border>

In my code behind I do the following: (after initializing components ...etc)

this.treeLayout.Layout(this.diagram, mymodel.ChildTreeLayoutViewModel.CurrentLayoutSettings);

Yet even thought the layout type is set to TreeDown, I get all the nodes on top of each other and I do not see a tree structure. How can I do this the right way? I need a tree structure of the nodes supplied through ObservableCollection<Object>

4

1 回答 1

1

基本上,对于此类问题,您有两种选择:

  1. 为设置形状的默认宽度和高度的形状添加样式。如果这不能很好地满足您的方案:
  2. 尝试在 Dispatcher.BeginInvoke 中调用布局

Dispatcher.BeginInvoke(() => this.treeLayout.Layout(...)

于 2013-07-16T07:05:03.150 回答