Home Forums WPF controls Xceed DataGrid for WPF How to make cell editable.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22600 |

    I am binding a DataTemplate to the CellContentTemplate.
    My DataTemplate contains a TextBox whose Text property is binded to the ‘LastName’ property of the DataSource object.
    Problem is that all the appeared TextBoxes are empty. Data is not Bounded to them. Here is my source code.

    <Window.Resources>
    <DataTemplate x:Key=”editableCellContentTemplate”>
    <TextBox Text=”{Binding Path = LastName, Mode= Default }”/>
    </DataTemplate>
    </Window.Resources>

    <Grid>
    <DockPanel LastChildFill=”True”>
    <StackPanel DockPanel.Dock=”Top”>
    <Button x:Name=”btnPopulateGrid”>Populate</Button>
    </StackPanel>
    <xcdg:DataGridControl x:Name=”exceedGrid”
    ItemsSource=”{Binding Path=GridDataSource, ElementName=exceedGridForm, Mode=Default}”>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”LastName”
    CellContentTemplate=”{StaticResource editableCellContentTemplate}”/>
    </xcdg:DataGridControl.Columns>

    </xcdg:DataGridControl>
    </DockPanel>
    </Grid>

    Imported from legacy forums. Posted by Rajesh Prajapati (had 1956 views)

    Xceed Support
    Member
    Post count: 5658

    When you are specifying in the Column definition that the FieldName is LastName, then the value of the Cell’s for this column will have the LastName as their content… Therefore, you need not to provide the “LastName” path in the CellContentTemplate:

    Try this:

    <DataTemplate x:Key=”editableCellContentTemplate”>
    <TextBox Text=”{Binding}”/>
    </DataTemplate>

    Imported from legacy forums. Posted by Marcus [Xceed] (had 2939 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.