powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / Как сделать верную разметку в WPF
1 сообщений из 1, страница 1 из 1
Как сделать верную разметку в WPF
    #35039060
учу ВПФ
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здравствуйте,
есть задача сделать форму в виде таблицы,
но при растягивании - все форматирование разваливается,
как сделать верную разметку при условии что Дата-грид имитируется через ListView
(тоесть есть еще проблема с имитацией header)

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
<Window x:Class="SheduleViewer.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="441" Width="1000">
    <Grid>
	<StackPanel Orientation="Vertical" Margin="0,0,0,12">
                <Border Height="45" Width="851" HorizontalAlignment="Stretch" 
                                            CornerRadius="5,5,5,5" BorderBrush="#FFD0601D">
                	<Border.Background>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#FFAAB650" Offset="0"/>
                			<GradientStop Color="#FFE2FF06" Offset="1"/>
                		</LinearGradientBrush>
                	</Border.Background>
                    <TextBlock TextAlignment="Center"  
                               FontFamily="Tahoma" 
                               FontSize="20" 
                               Text="Расписание работы" 
                               VerticalAlignment="Center" 
                               HorizontalAlignment="Center"/>
                </Border>
            <Grid Height="128.96">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="фото"              TextAlignment="Center" Width="050"/>
                <TextBlock Grid.Column="1" Text="номер"         TextAlignment="Center" />
	            <TextBlock Grid.Column="2" Text="ФИО"           TextAlignment="Center" />
	            <TextBlock Grid.Column="3" Text="дата"    TextAlignment="Center" />
		        <TextBlock Grid.Column="3" Text="информация"   TextAlignment="Center" HorizontalAlignment="Right" Width="139.999" Grid.ColumnSpan="3" Margin="0,0,139.714,0" />
             </Grid>
            <ListView x:Name="listView1" ItemsSource="{Binding Path=Table}" ItemTemplate="{StaticResource ListViewControlTemplate1}" HorizontalContentAlignment="Stretch" Height="177" />
        </StackPanel>
    </Grid>
</Window>

ресурсы:
<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
    <DataTemplate x:Key="ListViewControlTemplate1">
        <StackPanel>
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
              </Grid.ColumnDefinitions>
             
                    <Image     Grid.Row="0" Grid.Column="0" Source="{Binding Path=DOC_IMAGE}"   Width="50" Height="50"/> 
                    <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=ID}"            Width="050" Foreground="Black" Background="White" Opacity="100"/>
	                <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Path=DOC_NAME}"      Width="200" Foreground="Black" Background="White" Opacity="100"/>
	                <TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding Path=DOC_data}"   Width="300" Foreground="Black" Background="White" Opacity="100"/>

            </Grid>
	  </StackPanel>
    </DataTemplate>
</ResourceDictionary>

...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / Как сделать верную разметку в WPF
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]