Adding a TextBox to GridView

5 posts, 0 answers
  1. Sean Wright
    Sean Wright avatar
    14 posts
    Member since:
    May 2010

    Posted 05 May 2010 Link to this post


    I don't know why I can't find the answer to this anywhere online or in various Help resources, but here is the problem: I have a RadGridView in Silverlight. The majority of the columns are bound to a datasource, however, I need to have the very last column contain an empty TextBox which users can input text into. I can't figure out how to add a TextBox control to the column, though.

    Here is the GridView code. Can anyone tell me the syntax to insert a TextBox into that last column, the one whose HeaderText property is "Comments"?

    Thank you very much:

        <Grid x:Name="LayoutRoot" Margin="0,0,8,8">
       <Controls:RadGridView x:Name="theResultsGrid" AutoGenerateColumns="False" MinHeight="100" IsReadOnly="True" d:LayoutOverrides="GridBox" Margin="0,0,8,53" >
        <Controls:GridViewDataColumn HeaderText="Est. Code" DataMemberBinding="{Binding Path=EstimateCode}"/> 
        <Controls:GridViewDataColumn HeaderText="Order" DataMemberBinding="{Binding Path=EntryOrder}"/> 
        <Controls:GridViewDataColumn HeaderText="PcMk" DataMemberBinding="{Binding Path=PieceMarkConnectionCode}"/> 
        <Controls:GridViewDataColumn HeaderText="Drawing" DataMemberBinding="{Binding Path=Drawing}"/>
        <Controls:GridViewDataColumn HeaderText="Material Desc." DataMemberBinding="{Binding Path=AiscMaterial}"/>
        <Controls:GridViewDataColumn HeaderText="Grade" DataMemberBinding="{Binding Path=Grade}"/>
        <Controls:GridViewDataColumn HeaderText="SP" DataMemberBinding="{Binding Path=IsShipped}"/>
        <Controls:GridViewDataColumn HeaderText="MM" DataMemberBinding="{Binding Path=IsMainMember}"/>
        <Controls:GridViewDataColumn HeaderText="Material Wt." DataMemberBinding="{Binding Path=MaterialWeight}"/>
        <Controls:GridViewDataColumn HeaderText="Qty" DataMemberBinding="{Binding Path=MaterialQuantity}"/>
        <Controls:GridViewDataColumn HeaderText="Material Connection" DataMemberBinding="{Binding Path=MaterialConnections}"/>
        <Controls:GridViewDataColumn HeaderText="Length" DataMemberBinding="{Binding Path=Length}"/>
        <Controls:GridViewDataColumn HeaderText="Width" DataMemberBinding="{Binding Path=Width}"/>
        <Controls:GridViewDataColumn HeaderText="PricePerPound" DataMemberBinding="{Binding Path=PricePerPound}"/>
        <Controls:GridViewDataColumn HeaderText="Unit Price" DataMemberBinding="{Binding Path=UnitPrice}"/>
        <Controls:GridViewDataColumn HeaderText="Shop Shorthand" DataMemberBinding="{Binding Path=ShopShorthand}"/>
                    <Controls:GridViewDataColumn HeaderText="Labor Qty" DataMemberBinding="{Binding Path=LaborQuantity}"/>
                    <Controls:GridViewDataColumn HeaderText="Shop Hours" DataMemberBinding="{Binding Path=ShopHours}"/>
        <Controls:GridViewDataColumn HeaderText="Field Shorthand" DataMemberBinding="{Binding Path=FieldShorthand}"/>
        <Controls:GridViewDataColumn HeaderText="Field Hours" DataMemberBinding="{Binding Path=FieldHours}"/>
        <Controls:GridViewDataColumn HeaderText="Det. Hours" DataMemberBinding="{Binding Path=DetailingHours}"/>
        <Controls:GridViewColumn HeaderText="Comments"/>     
  2. Milan
    Milan avatar
    1989 posts

    Posted 06 May 2010 Link to this post

    Hello Sean Wright,

    You can use the CellTemplate property of our columns to customize what elements are shown in a column. For example:

    <telerikGrid:GridViewColumn Header="Name">
               <StackPanel Orientation="Horizontal">
                   <Image Stretch="None"
                          Margin="0,0,5,0" />
                   <TextBlock Text="{Binding Name}"
                              VerticalAlignment="Center" />

    Kind regards,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Sean Wright
    Sean Wright avatar
    14 posts
    Member since:
    May 2010

    Posted 11 May 2010 Link to this post

    Thank you. I'll try it out and see how well it works. I appreciate your response.
  4. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 18 Jan 2012 Link to this post

    Hi Sean,

    Did this example work out for you? I am trying to make a gridview for my website, using silverlight, that has a few columns as a text filed and let the users to input either a number or string of text. My problem is after input a string of text into the text field, those text won't stay there after i click anywhere inside the GridView
  5. Maya
    Maya avatar
    4062 posts

    Posted 19 Jan 2012 Link to this post

    Hello Johnny,

    I have just replied to the other forum thread you started on a similar topic. Please take a look at it and let me know in case you need any further assistance. 

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top