Hi!
I have implemented the solution described here: http://community.infragistics.com/forums/p/43348/238054.aspx#238054, adding "row details" when the user clicks on the record selector arrow. I need to know which event is getting fired, however, when the row details are expanded? I want to calculate some results to display, but I don't want this to happen if the user clicks anywhere else on the record (without expanding it). So far I've tried Grid_RecordActivated, Grid_RecordActivatedDirect, and Grid_SelectedItemsChanged, but they all fire regardless of where on the row the user clicks.
I know that the cellvaluepresenter is set to visible when the following event is triggered, but I do not know how to set this in the XAML on the grid.
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
Thanks,
Martin
I was able to solve it using this code:
Private Sub Grid_SelectedItemsChanged(sender As System.Object, e As Infragistics.Windows.DataPresenter.Events.SelectedItemsChangedEventArgs)
Dim temp As DataRecord = CType(sender, XamDataGrid).ActiveRecord
If temp.Cells("Details").Record.IsSelected = True Then
'execute code here
End If
End Sub
However, how do I remove the extra spacing that's added between each row (where the row details field is - I get that this is not an actual line spacing since my code is triggered when I click "between" the rows)?
Hello Martin,
I was looking into your posts and I believe that the space you are referring is created between the CellValuePrsenters within the DataRecordPresenter. In order to terminate this empty space between I can suggest you set a different margin for every CellValuePresenter. You can achieve this by creating a common style for all CellValuePresneters like this:
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Margin" Value="0,-2,0,-2"/>
</Style>
If this doesn’t suit your scenario, please let me know.
Yes that worked, BUT, it changed another aspect of the formatting. I'm using the Aero theme, and using the code you suggested, when I click in a cell the highlight becomes single-colored (dark blue) without the gradient effect. Also the highlight is now off-center. Attaching the code I used:
<igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Margin" Value="0,-2,0,-2"/> </Style></igDP:XamDataGrid.Resources>
I am not able to reproduce the behavior you are describing. I tested the scenario with the attached sample and I use version 11.1 build 11.1.20111.2113 . Could you please modify the attached sample in order to represent this issue or just attach a screenshot where the described coloring is shown. Also can you provide me with more details about the version of our product that you use?
Thanks in advance.
Hi Elena,
Attaching a sample showing my problem. I noted that the sample you provided did not address the problem, at least on my machine, in that placing the Style in Window.Resources does not work. For the row-height to decrease, I had to place the Style in the Grids' Resources, and that's when selection gets completely messed up. It has something to do with my grid being a read-only grid (allow edit is set to false). Hope you can help me using the attached sample, really appreciate it!
Regards,
Thank you for the sample. I was looking into it and in order to avoid merging of the fields I can suggest you modify the style to :
<Setter Property="Padding" Value="0,0,0,-5"/>
Furthermore if you want a different highlighting of the selected field from the default one you can modify the default template for the CellValuePresenter by binding its background to background of its template parent. You can achieve this by coping the templates for the XamDataGrid and modifying only the parts you want to change. You can find the default styles on your computer in the file C:\Program Files (x86)\Infragistics\NetAdvantage 2011.1\WPF\DefaultStyles\DataPresenter\DataPresenterGeneric_Express.xaml .
If you have any further questions on the matter, please do not hesitate to ask.
Thanks, I modified it slightly and used the style below to get the line-soacing to go away. I think you misunderstood me regarding the highlighting, however. I do want the default highlighting, but when modifying the grid using the style below, the default highlighting disappears. Instead I get a dark blue highlighting. It's not a big issue, but if you do come across a way to achieve this that'd be appreciated.
Regards,Martin
<igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Padding" Value="0"/> <Setter Property="Margin" Value="0,0,0,-5"/> </Style></igDP:XamDataGrid.Resources>
Interesting, I just downloaded the latest service release a couple of days ago. Anyhow, doesn't really matter, it still looks pretty good.
I test this with the latest service releases of 11.1 and I was not able to reproduce the different coloring, so this may be a fixed issue.
If you still have any concerns after installing the latest release, please let me know.
This is with the code to remove the spacing between rows attached to the bottom of my last post:
This is without:
I downloaded the latest service release. Thanks for your help.
I run your sample that you provide me with and I am not able to reproduce the different coloring. Could you please attach a screenshot that shows the different coloring, so I can be sure that we are looking on the same thing.
Thank you.