I have managed to display my data in a pivot grid, now I want to prevent the user dragging the columns around - anyone know how to do this? Or at least, how to stop columns just disappearing if dragged to the wrong place!
I am using a flat DataSource as per the example given here: http://community.infragistics.com/forums/t/43319.aspx?PageIndex=2
Hi
If you want to prevent the fields in columns/row/filter areas from deleting when they are drop inside the grid. You should retemplate the pivot grid control and remove the PivotPartType attached property. Below is extract from the template. The green box is a part of code you should remove.
<Style TargetType="igPivot:XamPivotGrid">
…
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="igPivot:XamPivotGrid">
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid x:Name="LayoutRoot" igPivot:TemplatedParentHelper.TemplatedParent="{Binding RelativeSource={RelativeSource TemplatedParent}}" igPivot:XamPivotGrid.PivotPartType="DeleteArea" Background="Transparent">
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Todor
Thanks for the quick reply, but where do I paste that code? I haven't got any template code at all so far...
Also, what is the definition of the namespave igPivot?
Here is part of my xaml file:
xmlns
:igControls="http://schemas.infragistics.com/xaml"
You need to use the code from second my post. If you have troubles, please attach you sample project, so I can see what is going on.
Hi Todor,
Thanks - I found my error - I had pasted the Style code into UserControl.Resources instead of Grid.Resources!I have made the MeasureAreaSettings the same as Row and Column, so now all I have to do is hide the "Drop Filter Fields Here" area and right-justify the numeric population fields.
I tried to define a new style as shown below but it didn't work :(
<Style TargetType="igPivotPrim:FieldsDropAreaControl" x:Key="invisibleFieldStyle">
<Setter Property ="Visibility" Value="Collapsed"/>
The easiest way to hide the filter area is to use code behind. The follow code show you how to hide filter area
pivotGrid.FiltersDropControl.Visibility = System.Windows.Visibility.Collapsed;
Of course there is a way to do this and in xaml, but procedure is a little bit complicated then one from code behind. It is related with new control template of the pivot grid.
About right justification you should apply new style for pivot cell control. Below is a sample.
1. Define new style resource
2. Set HorizontalContentAlignment property to Right
<Style x:Key="ScaledCell" TargetType="igPivot:PivotCellControl">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
Apply style to the grid
<igPivot:XamPivotGrid x:Name="pivotGrid" CellStyle="{StaticResource ScaledCell}">
</igPivot:XamPivotGrid>
What is the property to give the format "1,000.00" to the numeric data cells?
Thanks.
I Solved!
Thanks! =D