- wpfjoshsmith_src.zip
- WPF.JoshSmith
- Resources
- Images
- Composers
- bach.jpg
- beethoven.jpg
- chopin.jpg
- handel.jpg
- haydn.jpg
- mozart.jpg
- part.jpg
- reich.jpg
- scarlatti.jpg
- schoenberg.jpg
- Robots
- colorful robot.jpg
- reflected robot.jpg
- Robot up close.jpg
- Robot.jpg
- space robot.jpg
- Steelbot.jpg
- Weird Robot.jpg
- Wooden Robot.jpg
- Test.CenteredContentControl
- Test.DragCanvas
- Test.ListViewDragDropManager
- Test.RegexValidator
- Test.SlidingListBox
- Test.SmartTextBox
- Test.UnloadedManager
- Test.ValueConverterGroup
- WPF.JoshSmith.sln
- WPF.JoshSmith
- WPF.JoshSmith_src.zip
- WPFJoshSmith.zip
|
<Window x:Class="Test.ListViewDragDropManager.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:jas="clr-namespace:WPF.JoshSmith.ServiceProviders.UI;assembly=WPF.JoshSmith"
Title="ListViewDragDropManager Demo" Height="600" Width="700"
FontSize="12"
WindowStartupLocation="CenterScreen"
>
<Window.Resources>
<Style x:Key="ItemContStyle" TargetType="ListViewItem">
<Style.Resources>
<LinearGradientBrush x:Key="MouseOverBrush" StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#22000000" Offset="0" />
<GradientStop Color="#44000000" Offset="0.4" />
<GradientStop Color="#55000000" Offset="0.6" />
<GradientStop Color="#33000000" Offset="0.9" />
<GradientStop Color="#22000000" Offset="1" />
</LinearGradientBrush>
</Style.Resources>
<Setter Property="Padding" Value="0,4" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<!-- The default control template for ListViewItem has a Border
which contains the item's content. -->
<Setter Property="Border.BorderThickness" Value="0,0,0,0.5" />
<Setter Property="Border.BorderBrush" Value="LightGray" />
<!-- These triggers react to changes in the attached properties set
during a managed drag-drop operation. -->
<Style.Triggers>
<Trigger Property="jas:ListViewItemDragState.IsBeingDragged" Value="True">
<Setter Property="FontWeight" Value="DemiBold" />
</Trigger>
<Trigger Property="jas:ListViewItemDragState.IsUnderDragCursor" Value="True">
<Setter Property="Background" Value="{StaticResource MouseOverBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox Header="Main ListView Settings" Grid.Row="0" Margin="4" Padding="2">
<StackPanel>
<StackPanel.Resources>
<Style TargetType="CheckBox">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="IsChecked" Value="True" />
</Style>
</StackPanel.Resources>
<CheckBox
Name="chkManageDragging"
Margin="4"
>
Manage Dragging of ListViewItems
</CheckBox>
<StackPanel Margin="4" IsEnabled="{Binding ElementName=chkManageDragging, Path=IsChecked}">
<CheckBox
Name="chkDragAdorner"
Margin="0,4"
>
Show Drag Adorner
</CheckBox>
<StackPanel Orientation="Horizontal" Margin="0,4" IsEnabled="{Binding ElementName=chkDragAdorner, Path=IsChecked}">
<Label>Drag Adorner Opacity:</Label>
<Slider Name="sldDragOpacity" Value="0.7" Minimum="0" Maximum="1" Width="90" Margin="4" />
<Label Content="{Binding ElementName=sldDragOpacity, Path=Value}" />
</StackPanel>
</StackPanel>
<Line Stroke="DarkGray" Stretch="Fill" StrokeThickness="0.5" X1="0" X2="1" />
<CheckBox
Name="chkApplyContStyle"
Margin="4,8,4,4"
ToolTip="If checked, the ListView's ItemContainerStyle is set to a Style which reacts to the drag operation."
>
Apply Item Container Style
</CheckBox>
<CheckBox
Name="chkSwapDroppedItem"
IsChecked="False"
Margin="4"
ToolTip="If checked, the dropped item and the item at the target index will exchange locations."
>
Use Custom Drop Logic
</CheckBox>
<CheckBox
Name="chkShowOtherListView"
IsChecked="False"
Margin="4"
ToolTip="If checked, another ListView is visible. The items from one ListView can be dropped into the other ListView."
>
Show Other ListView
</CheckBox>
</StackPanel>
</GroupBox>
<ListView Name="listView"
Grid.Row="1"
ItemContainerStyle="{StaticResource ItemContStyle}"
Margin="4"
Padding="2"
SelectionMode="Single"
>
<ListView.View>
<GridView>
<GridViewColumn Header="Finished">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Finished}" HorizontalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Duration" DisplayMemberBinding="{Binding Duration}" Width="80" />
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="175" />
<GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}" Width="340" />
</GridView>
</ListView.View>
</ListView>
<ListView Name="listView2"
Grid.Row="2"
Height="185"
ItemContainerStyle="{StaticResource ItemContStyle}"
Margin="4"
Padding="2"
SelectionMode="Single"
Visibility="Collapsed"
>
<ListView.View>
<GridView>
<GridViewColumn Header="Finished">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Finished}" HorizontalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Duration" DisplayMemberBinding="{Binding Duration}" Width="80" />
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="175" />
<GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}" Width="340" />
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.