kpcnao
July 15, 2012, 9:36pm
1
Hi,
I want to know if there is a way to display an Overview of a diagram inside a DataGrid.RowDetailsTemplate. I tried to put a diagram and an overview inside a RowDetailsTemplate inside a DataGrid but it doesn’t work, is it impossible to display a diagram in a RowDetailsTemplate? When I put the overview outside the RowDetailsTemplate, it works fine.
Thanks
walter
July 16, 2012, 8:12am
2
Do you have the Overview and the observed Diagram in the same RowDetailsTemplate?
kpcnao
July 16, 2012, 11:29am
3
Yeah both are in the same RowDetailsTemplate
walter
July 16, 2012, 1:03pm
4
And how do you get Overview.Observed to refer to that Diagram?
kpcnao
July 16, 2012, 1:43pm
5
Here’s the XAML used :
Its works perfectly outside a RowDetailsTemplate. The diagram doesn't show inside the RowDetailsTemplate either.
<customGoXam:CustomDiagram Grid.Row="2" x:Name="objDiagram" MinHeight="100" Background="Red" >
<customGoXam:CustomDiagram.Model>
<Binding>
<Binding.Converter>
<Local:GridConverter />
</Binding.Converter>
</Binding>
</customGoXam:CustomDiagram.Model>
</customGoXam:CustomDiagram>
<go:Overview x:Name="myOverview" Grid.Row="3" Width="200" Height="100" Background="LightBlue" Observed="{x:Reference objDiagram}">
</go:Overview>
walter
July 17, 2012, 8:06am
6
Everything works fine when I try it with a minimal sample.
Here’s the XAML:
<Window x:Class="WpfApplication1.Window8"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:go="http://schemas.nwoods.com/GoXam"
Title="Window8" Width="600" Height="400">
<Grid>
<DataGrid x:Name="myDataGrid">
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<go:Diagram x:Name="myDetailDiagram"
BorderBrush="Blue" BorderThickness="2"
Width="400" Height="200"
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
NodesSource="{Binding Details}" />
<go:Overview Background="WhiteSmoke" BorderBrush="Green" BorderThickness="2"
Width="100" Height="100"
Observed="{Binding ElementName=myDetailDiagram}" />
</StackPanel>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
</Window>
and the code-behind:
[code]namespace WpfApplication1 {
public partial class Window8 : Window {
public Window8() {
InitializeComponent();
myDataGrid.ItemsSource = new ObservableCollection<Data>() {
new Data() { Name="Alpha", Details=new ObservableCollection<String>() { "a", "alpha", "aleph" } },
new Data() { Name="Beta", Details=new ObservableCollection<String>() { "two", "second" } },
new Data() { Name="Gamma", Details=new ObservableCollection<String>() { "3", "three", "third" } }
};
}
}
public class Data {
public String Name { get; set; }
public ObservableCollection Details { get; set; }
}
}[/code]