首页 > 代码库 > TreeListControl拖动模板设计
TreeListControl拖动模板设计
大家用的上的就直接用吧,就是一些小知识,不说废话了,用过了,帮忙支持一下就行,谢谢:
<DataTemplate x:Key="dragelementTemplate">
<Grid>
<StackPanel>
<Image Source="/MapSolution;component/Images/qOrange.png" Width="24" Height="24" Margin="2" Visibility="{Binding Path=DraggingRows[0].Content.IsGunCamera,Converter={StaticResource int2CollosedConverter}}"/>
<Image Source="/MapSolution;component/Images/oOrange.png" Width="24" Height="24" Margin="2" Visibility="{Binding Path=DraggingRows[0].Content.IsGunCamera,Converter={StaticResource int2VisibilityConverter}}"/>
<TextBlock FontFamily="微软雅黑" FontSize="24" Text="{Binding Path=DraggingRows[0].Content.Name}"/>
</StackPanel>
</Grid>
</DataTemplate>
<dxg:TreeListControl x:Name="treeList" Grid.Row="2" ItemsSource="{Binding Ships}" ShowBorder="False"
SelectionMode="{Binding SelectionMode}" FilterCriteria="{Binding FilterCriteria, ElementName=searchControl}">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="CameraID" VisibleIndex="0" Header="编码"/>
<dxg:TreeListColumn FieldName="Name" VisibleIndex="1" Header="名称"/>
<!--<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="CameraID" SummaryType="Count"/>
</dxg:TreeListControl.TotalSummary>
<dxg:TreeListControl.View>
<dxg:TreeListView x:Name="view"
ParentFieldName="ParentID" KeyFieldName="NodeID"
EditorShowMode="MouseUpFocused" AutoExpandAllNodes="True" NodeImageSelector="{StaticResource categoryImageSelector}"
AutoWidth="True" ShowTotalSummary="True" ShowFilterPanelMode="Never" ShowNodeImages="True" ShowColumnHeaders="False" ShowIndicator="False" ShowHorizontalLines="False" ShowVerticalLines="False">
</dxg:TreeListView>
</dxg:TreeListControl.View>
<i:Interaction.Behaviors>
<dxg:TreeListDragDropManager x:Name="dragDropManager" AllowDrag="True" DragOver="dragDropManager_DragOver_1" DragElementTemplate="{StaticResource dragelementTemplate}">
</dxg:TreeListDragDropManager>
</i:Interaction.Behaviors>
</dxg:TreeListControl>
private void dragDropManager_DragOver_1(object sender, DevExpress.Xpf.Grid.DragDrop.TreeListDragOverEventArgs e)
{
e.ShowDragInfo = true;
e.ShowDropMarker = true;
}