Hi,I'd like to ask if it is possible to drag measures/dimensions from the dataselector and drop it to some other controls in my application? Maybe I'm doing something wrong but I can't drop anything dragged from the dataselector even if I set the allowdrop of the target and handle the drop event.Thanks and best regards,Tamas
Hello Tamas,
At this moment drag-drop is encapsulated into control only. It’s possible to extend its drag-drop but you have to re-template some of the parts of both XamPivotGrid and XamPivotDataSelector. I’m going to attach here these two files:
1. App.xaml – contains the re-templated XamPivotDataSelector with additional DropTriggerActionEx instances attached.
2. DropTriggerActionEx.cs – contains the implementation of custom drop handler.
And here is how you’ll use it in your application:
Apply to selector the style from App.xaml:
<PivotGrid:XamPivotDataSelector Grid.Column="1"
x:Name="dataSelector"
DataSource="{StaticResource flatDataSource}"
Style="{StaticResource XamPivotDataSelectorStyle}"/>
Set some element as drop target. Note that when drop event handler is invoked drop target is checked by its name.
<StackPanel Name="externalDropTarget"
Background="LightBlue" Height="40">
<ig:DragDropManager.DropTarget>
<ig:DropTarget IsDropTarget="True"
DropChannels="Rows, Columns, Filters, MeasureList, Measures"
DropTargetMarkerBrush="Gold"/>
</ig:DragDropManager.DropTarget>
</StackPanel>
Also note that this will work only for drag-drop initiated from the data selector. In order to make this possible from pivot grid you have to re-template it as well and attach the additional DropTriggerActionEx to its elements in similar way as I’ve done for the data selector.
Regards.
Plamen.
Hi Plamen,
I have tried this and I have the error messages:
The tag 'Dropdown' does not exist in XML namespace 'http://schemas.infragistics.com/xaml'.
and
The type 'ig:Dropdown' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
I think I've added every assembly needed, but I may be wrong :)
Thanks and best regards,
Tamas
Tamas, did you remove ig prefix when you've tried it with Combobox. Also it should be ComboBox - with capital letter for box word.
Sorry I made a mistake, now it works fine. However the captions on the dataselector are lost (captions of the panels, update button etc). These captions are referred like this:
Content="{Binding StringSetting.DeferredUpdateLayoutCheckBoxLabel, RelativeSource={RelativeSource TemplatedParent}
Can I somehow get these strings, or should I simply enter a constant here?
Hi
These settings are new type of localization we implemented in 10.3 version of control. for now just replace it with a constant string
RegardsTodor
Hi Todor,
I have managed to create the same kind of panels that are on the dataselector, and dragging and dropping works fine.
Now I'd like to achieve the functionality to drag and drop the IOlapElements back to the dataselector, and in this case remove the elements from my own listbox.
Unfortunately after the following code the dragsource does not point to the listbox, but to a Border with a name "rootelement".
public class DropTriggerActionEx : XamTriggerAction<DragSource> { protected override void Invoke(object parameter) {
DropEventArgs args = parameter as DropEventArgs; if (args == null) { return; } FrameworkElement dropTarget = args.DropTarget as FrameworkElement; FrameworkElement dragSource = args.DragSource as FrameworkElement;....
So I simply cannot decide which listbox should I remove the dropped item from.
Can you give me a hint how I can get the "real" source of the drag?
Hi,
Can anyone please help me out on this? I'd need to find out which listbox have I dragged the item from.