Error in fixed wpf document

vitaminchik 466 Reputation points
2023-05-27T20:57:23.08+00:00

Hello. I am learning wpf, fixed docs, can you tell me how to fix my mistake? My document is displayed and printed crooked, why is this happening and some of the information is cut off. I have a DataGrid in the window, the user will add rows there and the DataGrid should increase in length.

Why does Visual Studio say it has errors :XDG0013, XLS0504

but does the program work?

Is it also possible to save this document so that it can be edited later?

thanks in advance.

User's image


<Window
        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/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ProgrammForKNRTU"
        xmlns:SQLite="clr-namespace:System.Data.SQLite;assembly=System.Data.SQLite" x:Class="ProgrammForKNRTU.CreateTableOfCloth"
        mc:Ignorable="d"
        WindowState="Maximized"
        Title="CreateTable"  WindowStyle="ThreeDBorderWindow" Icon="/table.png" BorderThickness="2,0,0,0">
    <Window.Background>
        <SolidColorBrush/>
    </Window.Background>

    <DocumentViewer>
        <FixedDocument>
            <PageContent>
                <FixedPage>
                    <Grid Background="#FFEAFEFF" Width="Auto" Height="Auto">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="34*"/>
                            <RowDefinition Height="35*"/>
                            <RowDefinition Height="35*"/>
                            <RowDefinition Height="35*"/>
                            <RowDefinition Height="35*"/>
                            <RowDefinition Height="55*"/>
                            <RowDefinition Height="355*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="15*"/>
                            <ColumnDefinition Width="145*"/>
                            <ColumnDefinition Width="125*"/>
                            <ColumnDefinition Width="155*"/>
                            <ColumnDefinition Width="155*"/>
                            <ColumnDefinition Width="115*"/>
                            <ColumnDefinition Width="88*"/>
                        </Grid.ColumnDefinitions>


                        <Button Content="Add row" RenderTransformOrigin="11.125,0.774" HorizontalAlignment="Right" Width="136" Grid.Column="5" Margin="0,23,10,0" Click="Button_Click" Grid.Row="6" Background="#FF9AFFFA" Grid.ColumnSpan="2" Height="20" VerticalAlignment="Top"/>
                        <DataGrid RenderTransformOrigin="3.75,5.091" Grid.Column="1" Margin="0,20,71,10" Grid.Row="6" CanUserAddRows="False"  x:Name="gridd" CanUserDeleteRows="False" CanUserResizeColumns="False" Grid.ColumnSpan="5" SelectionChanged="gridd_SelectionChanged" AutoGenerateColumns="False" >
                            <DataGrid.Columns>
                                <DataGridTextColumn x:Name="dataGridTextColumn" Header="№ п/п" Width="Auto" Binding="{Binding N1}" />
                                <DataGridTextColumn Header="№ п/п в модуле" Width="Auto" Binding="{Binding N2}"/>
                                <DataGridTextColumn Header="Name" Width="*" Binding="{Binding Name}" />
                                <DataGridTextColumn Header="Text"  x:Name="comboBoxOfSpecialnost" Width="Auto" Binding="{Binding Specialnoct}"/>
                                <DataGridTextColumn Header="text" Width="*" Binding="{Binding Oborudovaniye}"/>
                                <DataGridTextColumn Header="text" Width="Auto" Binding="{Binding Razryad}"/>
                                <DataGridTextColumn Header="text" Width="Auto" Binding="{Binding Time}"/>
                                <DataGridTextColumn Header="text" Width="Auto" Binding="{Binding Rascenka}"/>
                            </DataGrid.Columns>
                        </DataGrid>
                        <TextBox TextAlignment="Left" Grid.Column="1" TextWrapping="Wrap" Text="text" IsReadOnly="True" Background="{x:Null}" SelectionBrush="{x:Null}" Height="35" VerticalAlignment="Center" Grid.Row="1">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Row="2" TextWrapping="Wrap" Text="text:" VerticalAlignment="Center" Height="35" Background="{x:Null}" Grid.Column="1">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="left" Grid.Column="1" Grid.Row="4" TextWrapping="Wrap" Text="Text:" Background="{x:Null}" Height="35" VerticalAlignment="Center">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="1" Margin="0,0,2,0" Grid.Row="3" TextWrapping="Wrap" Text="Text" Background="{x:Null}" Height="35" VerticalAlignment="Center">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="1" Margin="0,5,2,0" Grid.Row="5" TextWrapping="Wrap" Text="text" Background="{x:Null}" Height="40" VerticalAlignment="Top">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <ComboBox x:Name="comboBoxOfClothes" Grid.Column="2" RenderTransformOrigin="0.667,-0.436" Height="35" VerticalAlignment="Center" Grid.Row="1">
                            <ComboBox.Background>
                                <LinearGradientBrush EndPoint="0,1">
                                    <GradientStop Color="#FFF0F0F0"/>
                                    <GradientStop Color="#FFE5E5E5" Offset="1"/>
                                    <GradientStop Color="#FFFFF9F9" Offset="0.98"/>
                                </LinearGradientBrush>
                            </ComboBox.Background>
                        </ComboBox>
                        <ComboBox Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" Height="35" x:Name="comboBoxOfGender" SelectionChanged="SelectedChangedOfComboBoxOfGender" />
                        <ComboBox x:Name="comboBoxOfSize" Grid.Column="2" Grid.Row="3" Height="35" VerticalAlignment="Center"/>
                        <DatePicker Grid.Column="2" Margin="0,5,0,0" Grid.Row="5" Height="40" VerticalAlignment="Top"/>
                        <TextBox Grid.Column="2" Grid.Row="4" TextWrapping="Wrap" Height="35" VerticalAlignment="Center"/>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="3" TextWrapping="Wrap" Text="text:" Background="{x:Null}" Height="35" VerticalAlignment="Center" Margin="5,0,0,0" Grid.Row="1">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="3" Grid.Row="2" TextWrapping="Wrap" Text="text:" Background="{x:Null}" Height="35" VerticalAlignment="Center" Margin="5,0,0,0">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox Grid.Column="4" TextWrapping="Wrap" Height="35" VerticalAlignment="Center" Grid.Row="1"/>
                        <ComboBox Grid.Column="4" Grid.Row="2" Height="35" VerticalAlignment="Center" x:Name="comboBoxOfMaterialVerha"/>
                        <ComboBox Grid.Column="4" Grid.Row="3" Height="35" VerticalAlignment="Center" x:Name="comboBoxOfMaterialPodklad"/>
                        <TextBox Grid.Column="4" Grid.Row="4" TextWrapping="Wrap" Height="35" VerticalAlignment="Center"/>
                        <DatePicker Grid.Column="4" Margin="0,5,0,0" Grid.Row="5" Height="40" VerticalAlignment="Top"/>
                        <TextBox Grid.Column="5" Margin="31,10,32,6" TextWrapping="Wrap" TextAlignment="Center" Text="text:" IsReadOnly="True" Grid.ColumnSpan="2" Background="{x:Null}">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="3" Grid.Row="3" TextWrapping="Wrap" Text="text:" Background="{x:Null}" Height="35" VerticalAlignment="Center" Margin="5,0,0,0" >
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.5"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox TextAlignment="Left" Grid.Column="3" Grid.Row="4" TextWrapping="Wrap" Text="text:" IsReadOnly="True" Background="{x:Null}" Height="35" VerticalAlignment="Center" Margin="5,0,0,0">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.3"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox IsReadOnly="True" TextAlignment="Left" Grid.Column="3" Margin="5,5,0,0" Grid.Row="5" TextWrapping="Wrap" Text="text:" Background="{x:Null}" Height="40" VerticalAlignment="Top">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0.5"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox TextAlignment="Right" Grid.Column="2" Margin="40,8,25,8" TextWrapping="Wrap" Text="text:" IsReadOnly="True" Background="{x:Null}" SelectionBrush="{x:Null}" Grid.ColumnSpan="2">
                            <TextBox.BorderBrush>
                                <SolidColorBrush Color="#FFABADB3" Opacity="0"/>
                            </TextBox.BorderBrush>
                        </TextBox>
                        <TextBox Grid.Column="4" Margin="0,8,0,8" TextWrapping="Wrap"/>
                        <Grid Grid.Column="5" Grid.ColumnSpan="2" Margin="20,34,20,12" Grid.RowSpan="5" Background="#FFFFF4F4" >
                            <Image Margin="12,0,12,0" x:Name="imageOfSavePicture" Stretch="Fill" Width="139"/>
                        </Grid>
                        <Button x:Name="bottonSavePicture" Grid.Column="5" Margin="20,8,0,0" Grid.Row="5" VerticalAlignment="Top" Grid.ColumnSpan="2" Content="Add picture" BorderBrush="#FF041916" Background="#FFA2F9FF" Click="BottonSavePicture" HorizontalAlignment="Left" Width="100" Height="20"/>
                    </Grid>
                </FixedPage>
            </PageContent>
        </FixedDocument>
    </DocumentViewer>
</Window>
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,709 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,602 questions
{count} votes