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"
Thanks for that Todor. Unfortunately I do not know how to use Blend, as I have only just started using Silverlight - indeed I am evaluating various vendors' controls to see how well they match our requirements.
I have put together a little project that consists of just a pivot grid, so I can explain what I need.
* User can drag columns around. I do not want them to be able to move them.
* User can delete column and row headers by clicking on the little 'X". I need to hide this "X".
* I also need to hide the little filter button
Hi,
The beauty of Silverlight and WPF is that you can change the UI of the component with out to have to know how they work. All this you can do by applying a new control template to the component.
To met the list with requirements you post above, all you need to do is to apply new control template to FieldItemControl.
I have attached a sample how to do that.
Hope this help.
Regards Todor
I get the message:
The attachable property 'IsTopLeftCornerControl' was not found in type 'PivotGridPanel'
Please advise.
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"/>
I Solved!
Thanks! =D
What is the property to give the format "1,000.00" to the numeric data cells?
Thanks.
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>