Hello!
I have a measure of my custom type "SplitValue", so my data is split in two parts and in PivotGrid the sum of two parts is shown. I've already managed to show these values in PivotGrid by writing custom aggregator, but I need to edit both of underlying values. I want to create a edit template with two textboxes instead of one, but I can't find a way to do this.
How can I do this?
Hello,
Another approach that could be used here is changing EditorStyle and modifying the default template of the TextBox control. Here is a code snippet for the same:<Style x:Key="EditorStyle" TargetType="TextBox"> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Padding" Value="2"/> <Setter Property="Margin" Value="0"/> <Setter Property="Foreground" Value="#FF333333"/> <Setter Property="BorderBrush" Value="Blue"/> <Setter Property="Background" Value="Red"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type TextBox}},Path=Text}" Background="Yellow"/> <TextBox Text="mhgfkjg" Background="Green"/> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>I am also attaching the sample project I have used to test the same. Please feel free to let me know whether this helps.
And additional problem here: if I'll change the template to the default one as you suggested, I'll lose all templates defined in XamPivotGrid.DataCellTemplates. So, default template isn't suitable here: I need to revert to the previous template, not he default one.
Maria,
As I said, CellEdited event is not fired when user presses Esc key, so I can't revert template in this case.
Additionally, I have another problem with your approach. When I click in my cell when editing, the CellEdited event is fired, and editing ends. But this can be accidential click, and I don't want editing to finish when user clicks in the same cell.
Please help me with this - I'm struggling with it for 2 days already, and it's urgent.
Hi,
The CellEdited event is fired after the cell exit edit mode and could be used to change the template to the default one that could be found under the Infragistics folder on your machine (C:\Program Files (x86)\Infragistics\2014.1\WPF\DefaultStyles\XamPivotGrid) or with other template.
But how do I remove that template when editing has finished? OnCellEdited event only fires when editing is approved, but how to revert the template when edit is canceled (Esc is pressed)?