I need to hide de colapse card button of single cards according to the data input, is this possible?
this is my code, it works fine for the style of de card header, but not to hide de collapse button
<igDP:XamDataCards.Resources> <vm:HeaderColorConverter x:Key="headerconv"/> <vm:HeaderFontSizeConverter x:Key="fontsconv" /> <vm:HeaderFontWeightConverter x:Key="fontwconv"/> <vm:HeaderAlignmentConverter x:Key="hdralignconv"/> <vm:ColapseButtonDisp x:Key="clpsbutton"/> <Style TargetType="{x:Type igDP:CardHeaderPresenter}"> <Setter Property="Height" Value="30"/> <Setter Property="Foreground" Value="White" /> <Setter Property="Background" Value="{Binding DataItem.Encabflag, Converter={StaticResource headerconv}}"/> <Setter Property="FontSize" Value="{Binding DataItem.Encabflag, Converter={StaticResource fontsconv}}"/> <Setter Property="FontWeight" Value="{Binding DataItem.Encabflag, Converter={StaticResource fontwconv}}"/> <Setter Property="HorizontalAlignment" Value="{Binding DataItem.Encabflag, Converter={StaticResource hdralignconv}}"/> </Style> <Style TargetType="{x:Type igDP:CardViewSettings}"> <Setter Property="CollapseCardButtonVisibility" Value="{Binding DataItem.Encabflag, Converter={StaticResource clpsbutton}}"/> </Style> <Style TargetType="{x:Type igDP:CellValuePresenter}"></Style> <Style TargetType="{x:Type igDP:LabelPresenter}" x:Key="hiddenLabel"> <Setter Property="Visibility" Value="Collapsed" /> </Style> </igDP:XamDataCards.Resources>
and this is the code behind
Class ColapseButtonDisp Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _ Implements System.Windows.Data.IValueConverter.Convert Dim EncabFlag As Integer = 0
If Integer.TryParse(value.ToString(), EncabFlag) Then Select Case EncabFlag Case 1 Return "Colapsed" Case Else Return "Visible" End Select End If
Return Nothing End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object _ Implements System.Windows.Data.IValueConverter.ConvertBack ' throw new NotImplementedException(); Return value End Function
End Class
Hello Jose,
I am just checking if my last reply was helpful for you.
If you require any further assistance, please do not hesitate to ask.
Thank you for your post.
I have been investigating this and I have created a sample project in order to achieve the functionality you have described. The CardViewSettings is not part of the visual tree and it does not have access to the data context. It cannot get the value of DataItem.Encabflag. This is the reason I have retemplated the CardHeaderPresenter.CollapseCardButtonStyleKey style using the DataPresenterGeneric.xaml file located in the …\Infragistics\NetAdvantage 2012.2\WPF\DefaultStyles\DataPresenter folder. I have bound the Visibility property of the CollapsedImage path to the DataItem.Encabflag using the clpsbutton converter. This will call the converter with EncabFlag and return Collapse or Visible depending on the value.
Please feel free to let me know if you have any questions on the matter.