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. How to change WPF table width and height

How to change WPF table width and height

Scheduled Pinned Locked Moved WPF
csharpwpftutorial
5 Posts 3 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 using WPF table in my application to display my data.But the table was fixed to particular width. I am not able to change this. I want this table's width as my WPF form width. I tried in <FlowDocument.Resources>, Style tag. But not able to change the width and height. Below is my code. <FlowDocumentReader Margin="67,150,51,267" > <FlowDocument> <FlowDocument.Resources> <Style TargetType="{x:Type Paragraph}"> <!--<Setter Property="" Value="100%"/>--> <Setter Property="FontSize" Value="12px"/> </Style> </FlowDocument.Resources> <Table CellSpacing="3" > <Table.Columns> <TableColumn /> <TableColumn /> <TableColumn/> </Table.Columns> <TableRowGroup> <!-- Header row for the table. --> <TableRow Background="Orange"> <TableCell> <Paragraph FontSize="12pt" FontWeight="Bold">Code</Paragraph> </TableCell> <TableCell > <Paragraph FontSize="12pt" FontWeight="Bold" >Description</Paragraph> </TableCell> <TableCell> <Paragraph FontSize="12pt" FontWeight="Bold">Amount</Paragraph> </TableCell> </TableRow> <!-- Three data rows for the inner planets. --> <TableRow> <TableCell> <Paragraph> 001 </Paragraph> </TableCell> <TableCell> <Paragraph> Tax Preparation Fee paid to LOS Taxes </Paragraph> </TableCell

    A 1 Reply Last reply
    0
    • N Nekkantidivya

      Hi, I am using WPF table in my application to display my data.But the table was fixed to particular width. I am not able to change this. I want this table's width as my WPF form width. I tried in <FlowDocument.Resources>, Style tag. But not able to change the width and height. Below is my code. <FlowDocumentReader Margin="67,150,51,267" > <FlowDocument> <FlowDocument.Resources> <Style TargetType="{x:Type Paragraph}"> <!--<Setter Property="" Value="100%"/>--> <Setter Property="FontSize" Value="12px"/> </Style> </FlowDocument.Resources> <Table CellSpacing="3" > <Table.Columns> <TableColumn /> <TableColumn /> <TableColumn/> </Table.Columns> <TableRowGroup> <!-- Header row for the table. --> <TableRow Background="Orange"> <TableCell> <Paragraph FontSize="12pt" FontWeight="Bold">Code</Paragraph> </TableCell> <TableCell > <Paragraph FontSize="12pt" FontWeight="Bold" >Description</Paragraph> </TableCell> <TableCell> <Paragraph FontSize="12pt" FontWeight="Bold">Amount</Paragraph> </TableCell> </TableRow> <!-- Three data rows for the inner planets. --> <TableRow> <TableCell> <Paragraph> 001 </Paragraph> </TableCell> <TableCell> <Paragraph> Tax Preparation Fee paid to LOS Taxes </Paragraph> </TableCell

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      FYI, I (and many others) do not even look at code if it is poorly formatted (no tabs) and isn't syntax highlighted. Here is an example of well formatted and syntax highlighted code:

      <Grid HorizontalAlignment="Stretch">
      <Grid.ColumnDefinitions>
      <ColumnDefinition />
      <ColumnDefinition />
      <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <Button Grid.Column="0" MaxWidth="100">Overwrite</Button>
      <Button Grid.Column="1" MaxWidth="100">Skip</Button>
      <Button Grid.Column="2" MaxWidth="100">Cancel</Button>
      </Grid>

      And here's what was typed to get the above to look the way it does:

      <pre lang="xml"><Grid HorizontalAlignment="Stretch">
      <Grid.ColumnDefinitions>
      <ColumnDefinition />
      <ColumnDefinition />
      <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <Button Grid.Column="0" MaxWidth="100">Overwrite</Button>
      <Button Grid.Column="1" MaxWidth="100">Skip</Button>
      <Button Grid.Column="2" MaxWidth="100">Cancel</Button>
      </Grid></pre>

      Basically, you just surround your code with PRE tags and make sure to specify the correct language (in my example, the language was XML) by setting the "lang" attribute to the appropriate value. I got all the ampersands, less than signs, and greater than signs to encode properly by clicking "Encode HTML tags when pasting", which is a checkbox just below the textbox you type messages into. By the way, my above code sample has nothing to do with your question... it's just a demonstration of what is expected from people who ask questions. FYI, you can edit your original post to improve it if you want; you'll be much more likely to get a response that way.

      Visual Studio is an excellent GUIIDE.

      L 1 Reply Last reply
      0
      • A AspDotNetDev

        FYI, I (and many others) do not even look at code if it is poorly formatted (no tabs) and isn't syntax highlighted. Here is an example of well formatted and syntax highlighted code:

        <Grid HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
        <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" MaxWidth="100">Overwrite</Button>
        <Button Grid.Column="1" MaxWidth="100">Skip</Button>
        <Button Grid.Column="2" MaxWidth="100">Cancel</Button>
        </Grid>

        And here's what was typed to get the above to look the way it does:

        <pre lang="xml"><Grid HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
        <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" MaxWidth="100">Overwrite</Button>
        <Button Grid.Column="1" MaxWidth="100">Skip</Button>
        <Button Grid.Column="2" MaxWidth="100">Cancel</Button>
        </Grid></pre>

        Basically, you just surround your code with PRE tags and make sure to specify the correct language (in my example, the language was XML) by setting the "lang" attribute to the appropriate value. I got all the ampersands, less than signs, and greater than signs to encode properly by clicking "Encode HTML tags when pasting", which is a checkbox just below the textbox you type messages into. By the way, my above code sample has nothing to do with your question... it's just a demonstration of what is expected from people who ask questions. FYI, you can edit your original post to improve it if you want; you'll be much more likely to get a response that way.

        Visual Studio is an excellent GUIIDE.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Whoops, you got your tags encoded!

        A 1 Reply Last reply
        0
        • L Lost User

          Whoops, you got your tags encoded!

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #4

          That was my intention. The first PRE block shows what syntax highlighting is and the second shows how to syntax highlight (by using PRE blocks).

          Visual Studio is an excellent GUIIDE.

          L 1 Reply Last reply
          0
          • A AspDotNetDev

            That was my intention. The first PRE block shows what syntax highlighting is and the second shows how to syntax highlight (by using PRE blocks).

            Visual Studio is an excellent GUIIDE.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Interesting, I don't recall having this happen when I've used the <pre> tags in the past. My apologies, I have obviously missed an experience, or maybe my brain hasn't kicked in properly this morning.

            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