Hello,
I want to modifiy the Visibility property using a DataTrigger,
the reason is because sometimes i need to put
<igDP:Field Name="prueba" Visibility="Collapsed"
and other times:
<igDP:Field Name="prueba" Visibility="Visible"
Thanks,
I want to do something like this but it doesn't work:
<igDP:Field Name="Excepciones" > <igDP:Field.Settings> <igDP:FieldSettings > <igDP:FieldSettings.CellPresenterStyle > <Style> <Style.Triggers> <DataTrigger Binding="{Binding Path=DataItem, Converter={StaticResource ConvTieneHijos}}" Value="True"> <Setter Property="Visibility" Value="True" /> </DataTrigger> <DataTrigger Binding="{Binding Path=DataItem, Converter={StaticResource ConvTieneHijos}}" Value="False"> <Setter Property="Visibility" Value="False" /> </DataTrigger> </Style.Triggers> </Style> </igDP:FieldSettings.CellPresenterStyle > </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
Hello Igor,
Thank you for your post. I have been looking into it and I am wondering if you want the whole field to be collapsed (all cells collapsed) or you want particular cells only to be collapsed?
Looking forward for your reply.
Hello Amilcar,
In the second link from the previous post:
http://ko.infragistics.com/community/blogs/josh_smith/archive/2008/06/06/binding-a-xamdatagrid-field-property.aspx
it is shown how you can create an instance of the ViewModel in code and then add it to the Applications' resource in order to use this in the XAML.
Hope this helps you.
Hey Stefan,
I apologize for bringing up an old issue but I'm having the same problem. I have a couple of fields that need to be hidden (the entire field) depending on some properties in my viewModel. This was initially working since I was able to hide them in my OnFieldInitialized handler but this no longer works since the data that ultimately sets the values of the dependent properties now comes back asynchronously; as a result, the OnFieldInitialized handler gets called before the properties are set.
I tried creating a couple of datatriggers on the CellValuePresenter that would hide the columns using the viewModel properties and a converter but they don't seem to work. My fields are loaded dynamically and are not hard coded into my xaml; furthermore, I cannot create an instance of my viewModel in the xaml since my viewModel does not have a default constructor. As a result, I couldn't use the links you sent.
This is an example of my datatrigger (this trigger is on the CellValuePresenter):
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="Rebate"> <Setter Property="igWPF:Field.Visibility" Value="{Binding Source={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.CashDealCount, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource CountVisibilityConverter}}" /> </DataTrigger>
I had to go back to the userControl level since the DataContext of the CellValuePresenter is the DataRecord and this would not contain my CashDealCount property - the property used to determine whether the column should be shown. I assume that didn't work because, as your links suggested, I am not binding using the Source property and instead using RelativeSource to get to the UserControl. But even the following doesn't work (also on the CellValuePresenter):
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Field.Name}" Value="Rebate"> <Setter Property="igWPF:Field.Visibility" Value="Collapsed" /> </DataTrigger>
Do you have any suggestions?
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I can suggest you see this forum thread:
http://ko.infragistics.com/community/forums/p/78723/431032.aspx
where a similar question is already discussed and this blog about binding Field's Visibility Property:
Please let me know if this helps you or you need further assistance on this matter.
Hello Stefan,
Thanks for you help! In first, i want the whole field be collapsed,