Hi Guys,
Is it possible to drag out measures, columns and rows like the Xamdatagrid, with 'X" sign coming up. How do we make that to work here in the PivotGrid?
Cheers,
anand
Thanks Rob this works great, but two more questions here, I overrode the style of the FilterFieldItemControl to blackish theme. how do I override the light green/blue default color of the adorner. Also I have some a converter in my FieldItemTemplate, how can I make this adorner use this converted value. For the datagrid when I changed the label presenter it seemed to pick up that style. The pivot grid seemed to be diff that way. Any thoughts there.
Again, I appreciate all the effort you take to answer these questions. Thanks again !!
<DataTemplate x:Key="FieldItemTemplateKey1">
<Border Background="#00FFFFFF">
<TextBlock VerticalAlignment="Center" >
<TextBlock.Text>
<MultiBinding Converter="{StaticResource PivotConv}">
<Binding RelativeSource="{RelativeSource AncestorType=ig:XamPivotGrid}" Path="DataSource" >
</Binding>
<Binding Path="Caption"></Binding>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Border>
</DataTemplate>
The XamDataGrid's 'X' cursor is actually a change to the Mouse.Cursor itself. There is a .cur file that contains it. I took that file, converted it to png and added it as an image in the data template so it now appears to use the same 'X' icon.
Rob thanks for your great work and this sample. How can I make this more similar to DataGrid's adorner preview and 'X' ?
Hi Anand,
This was a little tricky because of the way the pivotgrid handles the drag and drop. There is an internal class that the pivot grid uses for getting the required drag/drop templates and then it sets the appropriate template based on the current action. Since all of this is done internally there's no simple way to change the template that it uses.
What I managed to do was create a resource dictionary that takes the default template and slightly modifies the DragSource to include a DragStart event handler. I ended up needing to give the resource dictionary a code behind file as well in order to handle the event handler. Inside the event handler, I handled some more drag events and then I manually changed the drag template depending on what the mouse was over. The important thing to note here is that in order for this to work, the pivot grids internal drag/drop stuff needs to happen first. In order to ensure this I used a Dispatcher to hook up the events later. Now all you need to do is drop my resource dictionary into your project and then modify the DataTemplate called "removeItemDragCursorTemplate".
Hey Rob,
It works like a charm!!! Duhh, Sorry I mistakenly overrode that. Sorry about that. Also is there any way we can change the look 'X' of the drag adorner?
Anand