Mini Kabibi Habibi
<local:TreeListDemoModule x:Class="TreeListDemo.NodeTemplate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:global="clr-namespace:System.Globalization;assembly=mscorlib"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:TreeListDemo"
xmlns:dxdb="http://schemas.devexpress.com/winfx/2008/xaml/demobase"
xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="800">
<local:TreeListDemoModule.Resources>
<ResourceDictionary>
<local:ImageDataToVisibilityConverter x:Key="imageDataToVisibilityConverter"/>
<local:SpaceObjectsViewModel x:Key="spaceObjectsViewModel" />
<ControlTemplate x:Key="detailContainerTemplate" TargetType="{x:Type ContentControl}">
<Border BorderThickness="0,1,0,0" BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="12,12,12,12" Background="{TemplateBinding Background}">
<ContentPresenter />
</Border>
</ControlTemplate>
<DataTemplate x:Key="detailCoreTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxe:ImageEdit EditValue="{Binding Path=Row.ImageData}" Visibility="{Binding Path=Row.ImageData, Converter={StaticResource imageDataToVisibilityConverter}}"
Stretch="Uniform" Grid.Column="0" Grid.RowSpan="6" EditMode="InplaceInactive" Height="100" ToolTipService.ToolTip="Courtesy NASA/JPL-Caltech." />
<TextBlock Grid.Column="2" Grid.Row="0" FontWeight="Bold" Text="Mean radius (R of Earth):" />
<TextBlock Grid.Column="2" Grid.Row="1" FontWeight="Bold" Text="Volume (V of Earth):" />
<TextBlock Grid.Column="2" Grid.Row="2" FontWeight="Bold" Text="Mass (M of Earth):" />
<TextBlock Grid.Column="2" Grid.Row="3" FontWeight="Bold" Text="Surface gravity (g of Earth):" />
<TextBlock Grid.Column="2" Grid.Row="4" FontWeight="Bold" Text="Type of object:" />
<TextBlock Grid.Column="4" Grid.Row="0" Text="{Binding Row.MeanRadiusByEarth}" />
<TextBlock Grid.Column="4" Grid.Row="1" Text="{Binding Row.VolumeRByEarth}" />
<TextBlock Grid.Column="4" Grid.Row="2" Text="{Binding Row.MassByEarth}" />
<TextBlock Grid.Column="4" Grid.Row="3" Text="{Binding Row.SurfaceGravityByEarth}" />
<TextBlock Grid.Column="4" Grid.Row="4" Text="{Binding Row.TypeOfObject}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="nodeToolTipTemplate">
<ContentPresenter Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}">
<ToolTipService.InitialShowDelay>10</ToolTipService.InitialShowDelay>
<ToolTipService.HasDropShadow>false</ToolTipService.HasDropShadow>
<ToolTipService.ToolTip>
<ContentControl Content="{Binding}" ContentTemplate="{StaticResource detailCoreTemplate}" Tag="Transparent" MaxWidth="600"/>
</ToolTipService.ToolTip>
</ContentPresenter>
</DataTemplate>
<DataTemplate x:Key="nodeDetailTemplate">
<StackPanel Orientation="Vertical" >
<dx:MeasurePixelSnapper>
<ContentPresenter x:Name="defaultRowPresenter" Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}" />
</dx:MeasurePixelSnapper>
<dxg:RowDetailContainerControl Template="{StaticResource detailContainerTemplate}" Content="{Binding}" ContentTemplate="{DynamicResource detailCoreTemplate}" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="expandableNodeDetailTemplate">
<StackPanel Orientation="Vertical">
<dx:MeasurePixelSnapper>
<ContentPresenter x:Name="defaultRowPresenter" Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}" />
</dx:MeasurePixelSnapper>
<dx:DXExpander IsExpanded="{Binding Path=IsSelected}" HorizontalExpand="None" VerticalExpand="FromTopToBottom">
<dxg:RowDetailContainerControl Template="{StaticResource detailContainerTemplate}" Content="{Binding}" ContentTemplate="{DynamicResource detailCoreTemplate}" />
</dx:DXExpander>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="nameLinkTemplate">
<local:LinkButton Command="{Binding Path=RowData.View.DataContext.ShowWikiPageCommand}" CommandParameter="{Binding RowData.Row}" Width="Auto" Content="{Binding RowData.Row.Name}">
<local:LinkButton.Template>
<ControlTemplate>
<Grid Background="Transparent">
<TextBlock x:Name="PART_Text" Text="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center" Margin="5,0,0,0" Cursor="Hand"/>
</Grid>
</ControlTemplate>
</local:LinkButton.Template>
</local:LinkButton>
</DataTemplate>
</ResourceDictionary>
</local:TreeListDemoModule.Resources>
<dxdb:DemoModuleControl>
<dxdb:DemoModuleControl.OptionsContent>
<StackPanel Orientation="Vertical">
<dx:GroupFrame Header="Node Template">
<dxe:ListBoxEdit Background="{x:Null}" Margin="0,0,0,0" ShowBorder="False" SelectedIndex="0" EditValueChanged="NodeTemplateListBox_SelectionChanged">
<dxe:ListBoxEdit.StyleSettings>
<dxe:RadioListBoxEditStyleSettings />
</dxe:ListBoxEdit.StyleSettings>
<dxe:ListBoxEdit.Items>
<sys:String>Details</sys:String>
<sys:String>Animated Details</sys:String>
<sys:String>Tooltip</sys:String>
<sys:String>Default</sys:String>
</dxe:ListBoxEdit.Items>
</dxe:ListBoxEdit>
</dx:GroupFrame>
<dxe:CheckEdit Margin="0,12,0,12" IsChecked="{Binding Path=View.AllowPerPixelScrolling, Mode=TwoWay}" Content="Allow Per Pixel Scrolling" />
</StackPanel>
</dxdb:DemoModuleControl.OptionsContent>
<dxg:TreeListControl x:Name="treeList" DataContext="{StaticResource spaceObjectsViewModel}" ItemsSource="{Binding Path=SpaceObjects}">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="ObjectId" Visible="False" />
<dxg:TreeListColumn FieldName="ParentId" Visible="False" />
<dxg:TreeListColumn FieldName="Name" Header="Name" CellTemplate="{StaticResource nameLinkTemplate}" />
<dxg:TreeListColumn FieldName="MeanRadiusInKM" Header="Mean radius (km)" />
<dxg:TreeListColumn FieldName="Volume10pow9KM3" Header="Volume (10⁹ km³)" />
<dxg:TreeListColumn FieldName="Mass10pow21kg" Header="Mass (10²¹kg)" />
<dxg:TreeListColumn FieldName="DensitygBycm3" Header="Density (g/cm³)" />
<dxg:TreeListColumn FieldName="SurfaceGravitymBys2" Header="Surface gravity (m/s²)" />
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" AllowHorizontalScrollingVirtualization="False" KeyFieldName="ObjectId"
NavigationStyle="Row" ParentFieldName="ParentId" AutoWidth="True"
DataRowTemplate="{StaticResource nodeDetailTemplate}" AllowPerPixelScrolling="True" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
</dxdb:DemoModuleControl>
</local:TreeListDemoModule>