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
470
Cell Value not showing when bind with DataTable
posted

I have a DataTatble with a DataColumn defined as

DataTable dt = new DataTable();

            DataColumn dcPrice = new DataColumn("Price");

            dcPrice.DataType = typeof(decimal);

            dcPrice.DefaultValue = 54;

            dt.Columns.Add(dcPrice);

I am binding it with XamDataGrid using

Xamgrid.DataSource = dt.Rows

The code in XAML is

<igDP:Field Name="Price" Label="TaxCode" >

<igDP:Field.Settings>

            <igDP:FieldSettings />

      </igDP:Field.Settings>

</igDP:Field>

Which is working fine but if I use unbooundfield like below

 

<igDP:UnboundField Name="Price" Label="Price" BindingPath="Price">

<igDP:UnboundField.Settings>

      <igDP:FieldSettings   />

      </igDP:UnboundField.Settings>

</igDP:UnboundField>

Or

<igDP:UnboundField Name="Price" Label="Price" BindingPath="Price">

<igDP:UnboundField.Settings>

      <igDP:FieldSettings CellValuePresenterStyle="{StaticResource PriceCellStyle}"  />

      </igDP:UnboundField.Settings>

</igDP:UnboundField>

//Where PriceCellStyle is defined in Resources as

        <Style x:Key="PriceCellStyle" TargetType="{x:Type igDP:CellValuePresenter}">

            <Setter Property="Template">

                <Setter.Value>

                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

                        <StackPanel x:Name="stackPanel" Orientation="Horizontal">

                            <TextBox Text="{Binding Path=DataItem.Price}" ></TextBox>

                        </StackPanel>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>

        </Style>

 

Its not showing the values then

I need to show TextBox in the grid binded with the “Price” column as defined in the datatable

Thanks in Advance,

Rehman Mansoor