How do I set the background on a XamDataCard?
Hello Darlo,
In order to change the background of the XamDataCards you can use the Background property and set it to some color: Background="Azure". If you want to change the color of the DataRecordCellArea in the CardViewCard items of the XamDataCards you can set a style:
<Style TargetType="{x:Type igDP:DataRecordCellArea}">
<Setter Property="Background" Value="Yellow"/>
</Style>
Please let me know if you have any questions on the matter.
Hello Maria,
with your style sample I was able to make the background of all fields yellow. What about when I just want to set the backgroundcolor of a single field of a datacard, how can I do that? And I want to make all the other fields not editable. So my field "Real Weight" should have a yellow background and should be editable, the other fields should not. Right now my datacard Looks like this:
<igDP:XamDataCards Grid.Row="2" HorizontalAlignment="Left" Margin="12,12,0,0" Name="xamDataCards1" VerticalAlignment="Top" DataSource="{Binding ElementName=xamMultiColumnComboEditor1, Path=SelectedItems}"> <igDP:XamDataCards.FieldLayouts> <igDP:FieldLayout > <igDP:FieldLayout.Fields> <igDP:Field Name="Name" Label="Name" /> <igDP:Field Name="Volume" Label="Volume" /> <igDP:Field Name="TargetWeight" Label="Target Weight" /> <igDP:Field Name="ImageUrl" Label="Image" /> <igDP:UnboundField Name ="RealWeight" Label="Real Weight"> </igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataCards.FieldLayouts> </igDP:XamDataCards>
Hello Janimi,
In order to change the background color of one field you could use a style for the CellPresenter and set its Key property to some value. Then you could change the background color and use the style as StaticResource for the CellPresenterStyle property of the Field. You could also set the AllowEdit property to true to the fields you want to be editable and to false to the ones that should not be editable:
<Window.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type igDP:CellPresenter}">
</Window.Resources>
…
<igDP:Field Name=" Real Weight" >
<igDP:Field.Settings>
<igDP:FieldSettings CellPresenterStyle="{StaticResource CellStyle}" AllowEdit="True"/>
</igDP:Field.Settings>
</igDP:Field>
Please feel free to let me know if you have any other questions.