WPF Table control
-
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.
-
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.
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:
-
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:
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.
-
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.
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>