Uygulama penceremde basit bir Microsoft Word stili tablosu çizmeme izin veren bir yol (bileşenler/denetimler) olup olmadığını merak ediyordum. Böyle bir şey:WPF'de basit bir tablo oluşturma?
Herhangi bir fikir?
Uygulama penceremde basit bir Microsoft Word stili tablosu çizmeme izin veren bir yol (bileşenler/denetimler) olup olmadığını merak ediyordum. Böyle bir şey:WPF'de basit bir tablo oluşturma?
Herhangi bir fikir?
O bunu nasıl kullanmak istediğinize bağlıdır:
İşte nasıl kullanılacağı konusunda Tamam öğretici olduğunu. Ya ItemsControl
birini (gibi DataGrid
, ListView
vs) kullanmak da (diğer cevaplar önerdiği gibi) Grid
panel ile doğrudan yapmak veya bir FlowDocument
FlowDocument
Eğer Tablolar, satırlar ve sütunlar belirlemenizi sağlar kullanın. Ayrıca kopyala/Bu sayfa bu konuda yararlı örnekleriyle doludur vb
<FlowDocumentReader UseLayoutRounding="True" SnapsToDevicePixels="True">
<FlowDocumentReader.Resources>
<Style TargetType="TableCell">
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</FlowDocumentReader.Resources>
<FlowDocument>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
<TableColumn/>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell BorderBrush="Black" BorderThickness="1">
<Paragraph FontWeight="Bold">Category</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,1,1,1">
<Paragraph FontWeight="Bold">A</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,1,1,1">
<Paragraph FontWeight="Bold">B</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,1,1,1">
<Paragraph FontWeight="Bold">C</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderBrush="Black" BorderThickness="1,0,1,1">
<Paragraph FontWeight="Bold">Subscription</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>Monthly</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>Yearly</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>Monthly</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderBrush="Black" BorderThickness="1,0,1,1" TextAlignment="Center">
<Paragraph FontWeight="Bold">Price</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>$120.00</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>$1000.00</Paragraph>
</TableCell>
<TableCell BorderBrush="Black" BorderThickness="0,0,1,1">
<Paragraph>$130.00</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</FlowDocumentReader>
Yapıştır için aynı anda birden fazla hücreleri seçebilirsiniz: FlowDocument with Table Ben FlowDocument` I `farkında değildi
WPF Toolkit DataGrid denetimiyle başlamanızı öneririm. http://www.switchonthecode.com/tutorials/using-the-wpf-toolkit-datagrid
1 Yaklaşık 18 ay önce orta ölçekli bir WPF uygulamasını bitirdi ve bu yana hiçbir şey yapmadı. Benim Xaml-Fu oldukça paslı büyüdü :( –
Bazı garip nedenlerden dolayı, bir tablo oluşturduğumda, bir arama alanı ve tablo için farklı görünümler alıyorum.Ben bu bilgileri nasıl kaldırabilirim ve sadece ekstra bir fantezi olmadan tabloyu dahil edebilirim Özellikler? –