Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF Table control

WPF Table control

Scheduled Pinned Locked Moved WPF
csharpwpf
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nekkantidivya
    wrote on last edited by
    #1

    Hi, I am working on a WPF application. I want to place table with some lable controls in my form to display data. For this I tried the folowing code. <FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" > <FlowDocument > <Table CellSpacing="3" > <Table.Columns> <TableColumn Width="80" /> </Table.Columns> <TableRowGroup> <!-- Header row for the table. --> <TableRow Background="Orange"> <TableCell> <TextBox x:Name="txtTransmiterFee" Width="80" LostFocus="txtTaxPreperationFee_LostFocus"></TextBox> </TableCell> </TableRow> </TableRowGroup> </Table> </FlowDocument> Here I am getting some extra features for zooming, scrollbar etc, but I want just a table. If any one have any idea to place a table control in WPF or amy modifications in this code to display just like a table, please reply me. Thanks in advance.

    M 1 Reply Last reply
    0
    • N Nekkantidivya

      Hi, I am working on a WPF application. I want to place table with some lable controls in my form to display data. For this I tried the folowing code. <FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" > <FlowDocument > <Table CellSpacing="3" > <Table.Columns> <TableColumn Width="80" /> </Table.Columns> <TableRowGroup> <!-- Header row for the table. --> <TableRow Background="Orange"> <TableCell> <TextBox x:Name="txtTransmiterFee" Width="80" LostFocus="txtTaxPreperationFee_LostFocus"></TextBox> </TableCell> </TableRow> </TableRowGroup> </Table> </FlowDocument> Here I am getting some extra features for zooming, scrollbar etc, but I want just a table. If any one have any idea to place a table control in WPF or amy modifications in this code to display just like a table, please reply me. Thanks in advance.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Nekkantidivya wrote:

      Here I am getting some extra features for zooming, scrollbar etc, but I want just a table.

      Maybe you can use a simpler flow document reader like a FlowDocumentScrollViewer:

      <!--<FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" >-->
      <FlowDocumentScrollViewer IsToolBarVisible="False" Margin="131,133.738,184,217.262" HorizontalScrollBarVisibility="Hidden" >

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      N 1 Reply Last reply
      0
      • M Mark Salsbery

        Nekkantidivya wrote:

        Here I am getting some extra features for zooming, scrollbar etc, but I want just a table.

        Maybe you can use a simpler flow document reader like a FlowDocumentScrollViewer:

        <!--<FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" >-->
        <FlowDocumentScrollViewer IsToolBarVisible="False" Margin="131,133.738,184,217.262" HorizontalScrollBarVisibility="Hidden" >

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        N Offline
        N Offline
        Nekkantidivya
        wrote on last edited by
        #3

        Hi Mark Salsbery, Thanks for your reply. It helped me and now I am getting table without unnecessary features. But now the width of the table is fixed and I am unable to increase the width of the tableto the width of the form. Please reply me if you have any idea to solve this Thanks in advance.

        M 1 Reply Last reply
        0
        • N Nekkantidivya

          Hi Mark Salsbery, Thanks for your reply. It helped me and now I am getting table without unnecessary features. But now the width of the table is fixed and I am unable to increase the width of the tableto the width of the form. Please reply me if you have any idea to solve this Thanks in advance.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Nekkantidivya wrote:

          now the width of the table is fixed and I am unable to increase the width of the tableto the width of the form.

          Wrap the FlowDocumentScrollViewer in an element that resizes its children, like a Grid or a Window. For example (borrowing the flowdocument from the documentation), note how resizing this window resizes the table to fit:

          <Window x:Class="WPFTester.Window4"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:wpftk="http://schemas.microsoft.com/wpf/2008/toolkit"
          xmlns:local="clr-namespace:WPFTester"
          Title="Window4" Height="500" Width="500">
          <Grid >

              <FlowDocumentScrollViewer IsToolBarVisible="False" ><!--<FlowDocumentReader >-->
          
                  <FlowDocument>
          
                      <Table CellSpacing="5">
          
                          <Table.Columns>
                              <TableColumn/>
                              <TableColumn/>
                              <TableColumn/>
                              <TableColumn/>
                          </Table.Columns>
          
                          <TableRowGroup>
          
                              <!-- Title row for the table. -->
                              <TableRow Background="SkyBlue">
                                  <TableCell ColumnSpan="4" TextAlignment="Center">
                                      <Paragraph FontSize="24pt" FontWeight="Bold">Planetary Information</Paragraph>
                                  </TableCell>
                              </TableRow>
          
                              <!-- Header row for the table. -->
                              <TableRow Background="LightGoldenrodYellow">
                                  <TableCell>
                                      <Paragraph FontSize="14pt" FontWeight="Bold">Planet</Paragraph>
                                  </TableCell>
                                  <TableCell>
                                      <Paragraph FontSize="14pt" FontWeight="Bold">Mean Distance from Sun</Paragraph>
                                  </TableCell>
                                  <TableCell>
                                      <Paragraph FontSize="14pt" FontWeight="Bold">Mean Diameter</Paragraph>
                                  </TableCell>
                                  <TableCell>
          
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups