Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Some questions about XamDataGrid

Hi staff, 

i'm new of WPF and of XamDataGrid. I'm working about a new project and i some issues i can't solve.

This is XAML of the XamDataGrid

<igDP:XamDataGrid x:Name="GRD_CR_1" Grid.Column="1" VerticalAligment="Top"   GroupByAreaMode="MultipleFieldLayoutsCompact" BindToSampleData="False" InitializeRecord="Grd_InitializeRecord">
                <Style TargetType="{x:Type igDP:CellValuePresenter}">
                    <Setter Property="BorderThickness" Value="0,0,1,1" />
                    <Setter Property="BorderBrush"  Value="Black" />
                <igDP:FieldSettings AllowEdit="False" AllowFixing="No" AllowGroupBy="True" AllowSummaries="False" CellClickAction="SelectCell" />

                        <igDP:Field Name="P0700" Visibility="Collapsed" />
                        <igDP:Field Name="U_P0700" Label="07" Width="28px" BindingType="Unbound" />


1) Is there a way to see a preview of the XamDataGrid without writing BindToSampleData="True"?

2) I need to color the cell. I tried to achieve it writing the code you can see above but in running is rendered badly (except the first row). Why?

3) I have to change cell's background color at run-time.

I tried with this code but it doesn't work (i get a null exception in FromCell).

Where am i wrong?

private void Grd_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e)
            if (e.Record is DataRecord)
                var dr = (DataRecord)e.Record;
                var brush = new SolidColorBrush(Color.FromArgb(0, 63, 157, 211));

                if (int.Parse(dr.Cells["P0700"].Value.ToString()) != 0)
                    CellValuePresenter.FromCell(dr.Cells["U_P0700"]).Background = brush;

4) Last question (this is caused by my low level of WPF):

I prepared a XamDataGrid, and that is my default.

I need to copy it (at run-time) and paste it in the other grid of my Windows, changing the DataSource.

Someone can give me some advises?

Thank you very much,  and sorry for my bad English.

Parents Reply Children