我想在 WPF 中将标题设计,数据模型设计,页面设计拖放到下图中。此外,我附加了我想要使其可拖动和可拖放的代码或结构。
<ListBox Loaded="ActivityListBox_Loaded_1" Name="ActivityListBox" Height="{Binding ElementName=gd,Path=ActualHeight}" Canvas.Top="100" Width="{Binding ElementName=gd,Path=ActualWidth}" Background="Orange">
<ListBox.ItemTemplate >
<DataTemplate>
<Canvas x:Name="ActivityCanvas" Width="200" Height="70" Background="White" PreviewMouseLeftButtonDown="ActivityCanvas_PreviewMouseLeftButtonDown_1" >
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left" FontWeight="Bold" Height="70" Width="10" Background="{Binding ColorDefination}" Margin="0"></TextBlock>
<TextBlock Margin="30,-70,0,0" Text="{Binding ActivityTitle}" FontWeight="Bold" ></TextBlock>
<TextBlock Margin="30,-60,0,0" Text="{Binding ProjectComponentTitle}" ></TextBlock>
<TextBlock Margin="30,-40,0,0" Text="1 Jan-3Mar" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Image Name="imgDesc" MouseUp="imgDesc_MouseUp_1" Source="img/icons/icon.png" Margin="20,50,0,0" Canvas.Left="15" Canvas.Top="50"></Image>
<Image Name="imgComments" MouseUp="imgComments_MouseUp_1" Source="img/icons/icon_1.png" Margin="20,50,0,0" Canvas.Left="45" Canvas.Top="50"></Image>
<Image Name="imgMembers" MouseUp="imgMembers_MouseUp_1" Source="img/icons/icon_2.png" Margin="20,50,0,0" Canvas.Left="75" Canvas.Top="50"></Image>
<Image Name="imglinks" MouseUp="imglinks_MouseUp_1" Source="img/icons/t3.png" Margin="20,50,0,0" Canvas.Left="105" Canvas.Top="50"></Image>
</StackPanel>
</Canvas>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Vertical" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>