Mini Kabibi Habibi
<local:TreeListDemoModule
x:Class="TreeListDemo.DragDrop"
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:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxdbg="http://schemas.devexpress.com/winfx/2008/xaml/demobase/grid"
xmlns:collections="clr-namespace:System.Collections.Generic;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"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="800">
<local:TreeListDemoModule.Resources>
<ResourceDictionary>
<local:DragDropViewModel x:Key="viewModel"></local:DragDropViewModel>
<local:MultiSelectModeToBoolConverter x:Key="multiSelectModeToBoolToConverter" />
<local:EmployeeCategoryImageSelector x:Key="categoryImageSelector" />
</ResourceDictionary>
</local:TreeListDemoModule.Resources>
<dxdb:DemoModuleControl>
<dxdb:DemoModuleControl.OptionsContent>
<dx:DXDockPanel>
<dx:GroupFrame Header="Options" dx:DXDockPanel.Dock="Top" Margin="0,0,0,12">
<StackPanel DataContext="{StaticResource ResourceKey=viewModel}">
<dxe:CheckEdit Margin="0,0,0,6" x:Name="chkAllowDrag" Content="Enable Drag and Drop" VerticalAlignment="Top"
IsChecked="True" />
<dxe:CheckEdit Margin="0,0,0,6" x:Name="chkAllowMultiSelection" Content="Enable Multi-Selection"
IsChecked="{Binding SelectionMode, Converter={StaticResource multiSelectModeToBoolToConverter}, Mode=TwoWay}"
VerticalAlignment="Top" />
<dxe:CheckEdit Margin="0,0,0,6" x:Name="chkAllowContextMenu" Content="Enable Context Menu"
IsChecked="{Binding Path=IsRowCellMenuEnabled, ElementName=view, Mode=TwoWay}"
VerticalAlignment="Top" />
</StackPanel>
</dx:GroupFrame>
<dx:GroupFrame Header="Employees" dx:DXDockPanel.Dock="Bottom">
<dxe:ListBoxEdit ItemsSource="{Binding NewEmployees}" Height="410"
DataContext="{StaticResource ResourceKey=viewModel}">
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=GroupName, Converter={StaticResource categoryImageSelector}}"/>
<TextBlock Text="{Binding}" Margin="3,0,0,0" />
</StackPanel>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
<i:Interaction.Behaviors>
<dxg:ListBoxDragDropManager AllowDrop="False" AllowDrag="{Binding IsChecked, ElementName=chkAllowDrag}">
</dxg:ListBoxDragDropManager>
</i:Interaction.Behaviors>
</dxe:ListBoxEdit>
</dx:GroupFrame>
</dx:DXDockPanel>
</dxdb:DemoModuleControl.OptionsContent>
<dxg:TreeListControl x:Name="treeList" ItemsSource="{Binding Path=ActiveEmployees}"
DataContext="{StaticResource viewModel}" SelectionMode="{Binding SelectionMode}">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="JobTitle" VisibleIndex="0" />
<dxg:TreeListColumn FieldName="FullName" UnboundType="String"
UnboundExpression="[FirstName] + ' ' + [LastName]" VisibleIndex="1" ReadOnly="True" />
<dxg:TreeListColumn FieldName="City" VisibleIndex="2" />
<dxg:TreeListColumn FieldName="AddressLine1" Header="Address" VisibleIndex="3" />
<dxg:TreeListColumn FieldName="Phone" VisibleIndex="4" />
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.TotalSummary>
<dxg:TreeListSummaryItem FieldName="FullName" SummaryType="Count" />
</dxg:TreeListControl.TotalSummary>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view" NodeImageSelector="{StaticResource categoryImageSelector}"
ParentFieldName="ParentId" KeyFieldName="Id"
EditorShowMode="MouseUpFocused" AutoExpandAllNodes="True"
AutoWidth="True" ShowTotalSummary="True" ShowNodeImages="True">
<dxg:TreeListView.RootValue>
<sys:Int32>0</sys:Int32>
</dxg:TreeListView.RootValue>
<dxg:TreeListView.RowCellMenuCustomizations>
<dxb:BarButtonItem Content="Executive General and Administration" Glyph="/TreeListDemo;component/Images/Categories/Administration.png"
ItemClick="BarButtonItem_ItemClick" />
<dxb:BarButtonItem Content="Sales and Marketing" Glyph="/TreeListDemo;component/Images/Categories/Sales.png"
ItemClick="BarButtonItem_ItemClick" />
<dxb:BarButtonItem Content="Inventory Management" Glyph="/TreeListDemo;component/Images/Categories/Inventory.png"
ItemClick="BarButtonItem_ItemClick" />
<dxb:BarButtonItem Content="Research and Development" Glyph="/TreeListDemo;component/Images/Categories/Research.png"
ItemClick="BarButtonItem_ItemClick" />
<dxb:BarButtonItem Content="Manufacturing" Glyph="/TreeListDemo;component/Images/Categories/Manufacturing.png"
ItemClick="BarButtonItem_ItemClick" />
<dxb:BarButtonItem Content="Quality Assurance" Glyph="/TreeListDemo;component/Images/Categories/Quality.png"
ItemClick="BarButtonItem_ItemClick" />
</dxg:TreeListView.RowCellMenuCustomizations>
</dxg:TreeListView>
</dxg:TreeListControl.View>
<i:Interaction.Behaviors>
<dxg:TreeListDragDropManager x:Name="dragDropManager" AllowDrag="{Binding IsChecked, ElementName=chkAllowDrag}" Drop="dragDropManager_Drop">
</dxg:TreeListDragDropManager>
</i:Interaction.Behaviors>
</dxg:TreeListControl>
</dxdb:DemoModuleControl>
</local:TreeListDemoModule>