Hi,
I tried to binding DragChannels and didn't work, application and vs froze.
<DataTemplate x:Key="DatoItemTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <CheckBox Margin="3" IsChecked="{Binding Seleccionado, Mode=TwoWay}" /> <Grid Grid.Column="1" > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ig:DragDropManager.DragSource> <ig:DragSource IsDraggable="True" DragChannels="{Binding Path=Canal}" /> </ig:DragDropManager.DragSource> <Image Margin="3" Width="15" Height="15" Source="{Binding Imagen, Mode=OneWay}" /> <TextBlock Margin="3" Grid.Column="1" Text="{Binding Nombre, Mode=OneWay}" /> </Grid> </Grid> </DataTemplate>
is this an error? or really cannot be.
SL4 and IG 10.2.20102.1029.
Thanks
DragChannels is not a DependencyProperty that's why the binding doesn't work. That will be fixed with the next service release.
Thanks.
Is there any way to change DragChannels property in code?
Let say you have drop target like this one:
<Rectangle Fill="Red" Stroke="Black" StrokeThickness="1">
<ddm:DragDropManager.DropTarget>
<ddm:DropTarget IsDropTarget="True" DropChannels="ChannelA"/>
</ddm:DragDropManager.DropTarget>
</Rectangle>
And drag source like this one (it can be placed within DataTemplate as well):
…
<Rectangle Fill="Orange" Stroke="Black" StrokeThickness="1">
<ddm:DragDropManager.DragSource>
<ddm:DragSource IsDraggable="True"
DragStart="DragSource_DragStart"/>
</ddm:DragDropManager.DragSource>
The easiest way to obtain the instance of the attached DragSource object is to subscribe for DragSource.DragStart event and when it’s fired you can change the channels:
private void DragSource_DragStart(object sender, DragDropStartEventArgs e)
{
DragSource dragSource = DragDropManager.GetDragSource(e.DragSource);
if (dragSource != null)
dragSource.DragChannels.Clear();
dragSource.DragChannels.Add("ChannelA");
}
Regards.