Lester's WPF\SL Blog

Simple, Easy & Beautiful

Table editing...On its Way!!

Table editing...On its Way!!

  • Comments 3

An interesting feature in editing is TableEditing. Everyone of us has created a table sometime or the other. So in light of its importance we included the table construct. However, the editing aspects are limited in the CPT release and hence, if you come across some glitches be assured that it will be addressed in the next release.

Now for some XAML code. Its pretty simple:

<Grid xmlns='http://schemas.microsoft.com/winfx/avalon/2005'
xmlns:x='http://schemas.microsoft.com/winfx/xaml/2005'>
<RichTextBox>
   <FlowDocument>
      <FlowDocument.Resources>

         <Style TargetType='{x:Type TableCell}'>
            <Setter Property='BorderThickness' Value='1' />

            <Setter Property='BorderBrush' Value='Black' />
         </Style>

      </FlowDocument.Resources>

      <Table BorderThickness="2" BorderBrush="BLUE">
         <TableRowGroup >
            <TableRow >
                <TableCell ><Paragraph>Text</Paragraph></TableCell >
                <TableCell ><Paragraph>Text</Paragraph></TableCell >
            </TableRow>
            <TableRow >
                <TableCell ><Paragraph>Text</Paragraph></TableCell >
                <TableCell ><Paragraph>Text</Paragraph></TableCell >
            </TableRow>
         </TableRowGroup>
      </Table>
   </FlowDocument>
</RichTextBox>
</Grid>

 

Image hosted by Photobucket.com

Lets look at the code. The table has a border color set and the same applies to the table cells. However, for the tablecells we use a style as this makes the code neater and easier to manage. By default, the border colors are the same as the background and this makes it difficult to identify the cells and the table itself.

Within the table we have a tableRowGroup and then the TableRows, which inturn contain tableCells. These cells must contain a Block to hold the content - So a valid contruct could be a Paragraph or a BlockUIContainer.

As for the editing aspects, we support the basic editing scenarios. So you can edit content within the cells, add rows, delete rows and so forth. And remember to have border colors ;)

  • Ths seems to be a broken feature. I cannot perform simple column operations. I hope the next version is better :)
  • thnks 4 the tip on styling the cells. Tht was a life saver - saved me time figuring out where the cells were ;)
  • Patrick, you are right that the column operations are not supported. But as mentioned in the post we do support basic scenarios. We decided that Table Editing was an important feature and provided the basic version in the CTP bits. We are aware of the chinks and they are being addressed.
    So the good news is that you can definitely expect a lot better experience with Tables in the next version you lay hands on...
Page 1 of 1 (3 items)