Impossible to create scrollbar C# WPF - c#

I am currently trying to put a scrollBar in my C# app (using WPF)
even if I use a scrollbar object in WPF
(the scrollbar is still disable (in grey))
<GroupBox Header="Setting" Margin="5,0,5,0" Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Auto" IsManipulationEnabled="True">
<TabControl x:Name="tabSetting" Margin="5,0,5,0" >
<TabItem x:Name="Tab_CmdSettings" Header="CMD settings">
<Grid Name="grid_CMD_settings" ScrollViewer.CanContentScroll="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="A1A2 fall voltage (% Un_min)" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_dtr" Height="21" TextWrapping="Wrap" Text="nvm_dtr" HorizontalAlignment="Left" Margin="0,3,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
<Label x:Name="label_Unmin" Content="Un_min= " HorizontalAlignment="Left" Margin="130,0,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="A1A2 rise voltage (% Un_max)" HorizontalAlignment="Left" Margin="0,20,0,0" VerticalAlignment="Top" Grid.Column="0"/>
...
...
OR
I try to use the Property
AutoScroll = "true"
in my form.
But it was not recognized and it crash during compile
I think that this Properties come from the WinForm not WPF
<GroupBox Header="Protection Parameters" Grid.Row="0" Grid.ColumnSpan="2" AutoScroll="True">
<Grid Name="grid_Protection" AutoScroll="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="84*"/>
<ColumnDefinition Width="145*"/>
<ColumnDefinition Width="287*"/>
</Grid.ColumnDefinitions>
<Label Content="Short circuit function selection" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="2"/>
<RadioButton x:Name="radioButton_buff_enascc_On" GroupName="group_enascc" Content="Enable" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="2" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enascc_Off" GroupName="group_enascc" Content="Disable" HorizontalAlignment="Left" Margin="100,5,0,0" VerticalAlignment="Top" Grid.Column="2" />
<Label Content="Short circuit current level (x Ir_max)" HorizontalAlignment="Left" Margin="0,20,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="2"/>
<TextBox x:Name="textBox_buff_ie3scc" Height="21" TextWrapping="Wrap" Text="nvm_ie3scc" HorizontalAlignment="Left" Margin="0,23,0,0" VerticalAlignment="Top" Width="120" Grid.Column="2" />
</GroupBox>
...
</Grid>
...
</TabItem>
...
Does anyone know what I am doing wrong?
Doesn't it enough to insert a scrollbar or add AutoSize?
Is it mandatory to code in C#?

From the Properties of WinForms make the AutoScroll Property True.
The ScrollBar will be only appeared
if the Content of the elements of the Form is bigger than the actual Form Control or
if the Form does not fit in the screen resolution of the screen.

Try adding more controls to make your window size less than the currently present content so that height current view is greater than the present components, so there will be a need for a scroll bar. hence your scroll bar is displayed accordingly.

#Brainy_Clown
Agree but ...i put all the graphical object in a StackPanel to set the min size.
when i reduce the windows to min or max, the scrollbar still unavailable.
<Window x:Class="MPDE_Monitor.MainWindow"
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:MPDE_Monitor"
mc:Ignorable="d"
Title="MPDE Monitor" Height="980" Width="600" Closing="Window_Closing" ResizeMode="CanResizeWithGrip" MinWidth="600" MinHeight="700">
<Grid>
<Menu IsMainMenu="True" VerticalAlignment="Top">
<MenuItem Header="_File">
<MenuItem x:Name="menu_connect" Header="_Connect" Click="connect_Click" />
<MenuItem x:Name="menu_reloadini" Header="Reload INI file" Click="menu_reloadini_Click" />
<TextBox Text="Factory mode" KeyDown="TextBox_KeyDown" PreviewMouseLeftButtonDown="TextBox_PreviewMouseLeftButtonDown"/>
<Separator />
<MenuItem x:Name="menu_exit" Header="_Exit" Click="menu_exit_Click" />
</MenuItem>
<MenuItem x:Name="menu_about" Header="_About" Click="menu_about_Click" />
</Menu>
<GroupBox x:Name="group1" Header="Connection settings" Margin="9,22,10,0" VerticalAlignment="Top" Height="71">
<Grid Margin="2,0,-3,0">
<RadioButton x:Name="radioUART" GroupName="com_port" Content="UART" HorizontalAlignment="Left" Margin="50,8,0,0" VerticalAlignment="Top" IsChecked="True" Checked="RadioButton_Checked"/>
<RadioButton x:Name="radioSPI" GroupName="com_port" Content="SPI" HorizontalAlignment="Left" Margin="7,8,0,0" VerticalAlignment="Top" Checked="RadioButton_Checked"/>
<Label Content="Port :" Margin="103,3,315,0" VerticalAlignment="Top"/>
<ComboBox x:Name="Comm_port" HorizontalAlignment="Left" Margin="139,4,0,0" VerticalAlignment="Top" Width="60" DropDownOpened="Comm_port_DropDownOpened"/>
<Button x:Name="connect" Content="Connect" HorizontalAlignment="Left" Margin="207,4,0,0" VerticalAlignment="Top" Width="70" Click="connect_Click"/>
<Label x:Name="conn_status" Content="connection msg" Margin="282,0,69,0" VerticalAlignment="Top" Height="29"/>
...
<Label Content="Factory mode:" Margin="7,23,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="91" RenderTransformOrigin="0.479,-0.25"/>
<TextBox x:Name="password" Text="Password" KeyDown="TextBox_KeyDown" PreviewMouseLeftButtonDown="TextBox_PreviewMouseLeftButtonDown" HorizontalAlignment="Left" Margin="102,28,0,0" VerticalAlignment="Top"></TextBox>
</Grid>
</GroupBox>
<TabControl x:Name="tabControl" Margin="10,98,10,227">
...
<TabItem x:Name="Tab_Conf_Setting" Header="Config and Settings">
<Grid Name="grid_Monitor1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<GroupBox Header="Product" Margin="5,0,5,0" Grid.Row="0">
<Grid Name="grid_Product" >
<Label Content="Target product" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="comboBox_buff_tag" HorizontalAlignment="Left" Margin="125,3,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="B0/B1 24V" IsSelected="True"/>
<ComboBoxItem Content="B0/B1 Wide range"/>
</ComboBox>
<Label Content="Ir range (A)" HorizontalAlignment="Left" Margin="10,30,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="comboBox_buff_range" HorizontalAlignment="Left" Margin="125,33,0,0" VerticalAlignment="Top" Width="120">
<ComboBoxItem Content="not_selected (default)" IsSelected="True"/>
<ComboBoxItem Content="[0.15A - 0.6A] (LUCxX6xx)"/>
...
</ComboBox>
<Label Content="A1A2 voltage (V)" HorizontalAlignment="Left" Margin="275,0,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="comboBox_buff_a1a2" HorizontalAlignment="Left" Margin="400,3,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="not_selected (default)" IsSelected="True"/>
<ComboBoxItem Content="24Vdc (LUxxxxBL)"/>
...
</ComboBox>
<Label Content="Type of control unit" HorizontalAlignment="Left" Margin="275,30,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="comboBox_buff_uctype" HorizontalAlignment="Left" Margin="400,33,0,0" VerticalAlignment="Top" Width="120">
<ComboBoxItem Content="not_selected (default)" IsSelected="True"/>
<ComboBoxItem Content="B0 - Class 10 - 3 phases [LUCA]"/>
...
</ComboBox>
<Label Content="Diagnostic contactor (only B3)" HorizontalAlignment="Left" Margin="10,55,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_diag_On" GroupName="group_diag" Content="Enable" HorizontalAlignment="Left" Margin="185,62,0,0" VerticalAlignment="Top" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_diag_Off" GroupName="group_diag" Content="Disable" HorizontalAlignment="Left" Margin="300,62,0,0" VerticalAlignment="Top" />
</Grid>
</GroupBox>
<GroupBox Header="Setting" Margin="5,0,5,0" Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Auto" IsManipulationEnabled="True">
<StackPanel MinHeight="700" MinWidth="500">
<TabControl x:Name="tabSetting" Margin="5,0,5,0">
<TabItem x:Name="Tab_CmdSettings" Header="CMD settings">
<Grid Name="grid_CMD_settings" ScrollViewer.CanContentScroll="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="A1A2 fall voltage (% Un_min)" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_dtr" Height="21" TextWrapping="Wrap" Text="nvm_dtr" HorizontalAlignment="Left" Margin="0,3,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
...
</Grid>
</TabItem>
<TabItem x:Name="Tab_PTR_Settings" Header="PRT settings" ScrollViewer.CanContentScroll="True">
<Grid Name="grid_PTR_Settings" ScrollViewer.CanContentScroll="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30*"/>
<ColumnDefinition Width="481*"/>
</Grid.ColumnDefinitions>
<GroupBox Header="Protection Parameters" Grid.Row="0" Grid.ColumnSpan="2">
<Grid Name="grid_Protection">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Short circuit function selection" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_enascc_On" GroupName="group_enascc" Content="Enable" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enascc_Off" GroupName="group_enascc" Content="Disable" HorizontalAlignment="Left" Margin="100,5,0,0" VerticalAlignment="Top" Grid.Column="1" />
<Label Content="Short circuit current level (x Ir_max)" HorizontalAlignment="Left" Margin="0,20,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_ie3scc" Height="21" TextWrapping="Wrap" Text="nvm_ie3scc" HorizontalAlignment="Left" Margin="0,23,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
<Label Content="Magnetic function selection" HorizontalAlignment="Left" Margin="0,40,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_enamgn_On" GroupName="group_enamgn" Content="Enable" HorizontalAlignment="Left" Margin="0,45,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enamgn_Off" GroupName="group_enamgn" Content="Disable" HorizontalAlignment="Left" Margin="100,45,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Magnetic current level (x Ir)" HorizontalAlignment="Left" Margin="0,60,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_imgn" Height="21" TextWrapping="Wrap" Text="nvm_imgn" HorizontalAlignment="Left" Margin="0,63,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1"/>
<Label Content="TRIP when magnetic fault (only B3)" HorizontalAlignment="Left" Margin="0,80,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_trpmgn_On" GroupName="group_trpmgn" Content="Enable" HorizontalAlignment="Left" Margin="0,85,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_trpmgn_Off" GroupName="group_trpmgn" Content="Disable" HorizontalAlignment="Left" Margin="100,85,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Overload function selection" HorizontalAlignment="Left" Margin="0,100,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_enaovl_On" GroupName="group_enaovl" Content="Enable" HorizontalAlignment="Left" Margin="0,105,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enaovl_Off" GroupName="group_enaovl" Content="Disable" HorizontalAlignment="Left" Margin="100,105,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Protection class" HorizontalAlignment="Left" Margin="0,120,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<ComboBox x:Name="comboBox_buff_cls" HorizontalAlignment="Left" Margin="0,123,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1">
<ComboBoxItem Content="Class 5" IsSelected="True" />
<ComboBoxItem Content="Class 10"/>
</ComboBox>
<Label Content="Motor type" HorizontalAlignment="Left" Margin="0,140,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_mono_On" GroupName="group_mono" Content="Single phase" HorizontalAlignment="Left" Margin="0,145,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_mono_Off" GroupName="group_mono" Content="Three phase" HorizontalAlignment="Left" Margin="100,145,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Phase loss function selection" HorizontalAlignment="Left" Margin="0,160,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_enaloss_On" GroupName="group_enaloss" Content="Enable" HorizontalAlignment="Left" Margin="0,165,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enaloss_Off" GroupName="group_enaloss" Content="Disable" HorizontalAlignment="Left" Margin="100,165,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Phase loss duration (ms)" HorizontalAlignment="Left" Margin="0,180,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_tloss" Height="21" TextWrapping="Wrap" Text="nvm_tloss" HorizontalAlignment="Left" Margin="0,183,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1"/>
<Label Content="TRIP when phase loss fault (only B3)" HorizontalAlignment="Left" Margin="0,200,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_trploss_On" GroupName="group_trploss" Content="Enable" HorizontalAlignment="Left" Margin="0,205,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_trploss_Off" GroupName="group_trploss" Content="Disable" HorizontalAlignment="Left" Margin="100,205,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Ground fault function selection" HorizontalAlignment="Left" Margin="0,220,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_enagf_On" GroupName="group_enagf" Content="Enable" HorizontalAlignment="Left" Margin="0,225,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_enagf_Off" GroupName="group_enagf" Content="Disable" HorizontalAlignment="Left" Margin="100,225,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="Ground fault level (x Ir)" HorizontalAlignment="Left" Margin="0,240,0,0" VerticalAlignment="Top" Grid.Column="0" />
<TextBox x:Name="textBox_buff_ig2" Height="21" TextWrapping="Wrap" Text="nvm_ig2" HorizontalAlignment="Left" Margin="0,245,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1"/>
<Label Content="Desensitization level (x Ir)" HorizontalAlignment="Left" Margin="0,260,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<ComboBox x:Name="comboBox_buff_idsz1" HorizontalAlignment="Left" Margin="0,263,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1">
<ComboBoxItem Content="18.0 (No desensitization !)" IsSelected="True"/>
<ComboBoxItem Content="3.0"/>
</ComboBox>
<Label Content="Desensitizated GF level (x Ir)" HorizontalAlignment="Left" Margin="0,280,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<ComboBox x:Name="comboBox_buff_igdsz1" HorizontalAlignment="Left" Margin="0,283,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1">
<ComboBoxItem Content="2.0" IsSelected="True"/>
<ComboBoxItem Content="3.0"/>
</ComboBox>
<Label Content="TRIP when ground fault (only B3)" HorizontalAlignment="Left" Margin="0,300,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_trpgf_On" GroupName="group_trpgf" Content="Enable" HorizontalAlignment="Left" Margin="0,305,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_trpgf_Off" GroupName="group_trpgf" Content="Disable" HorizontalAlignment="Left" Margin="100,305,0,0" VerticalAlignment="Top" Grid.Column="1"/>
</Grid>
</GroupBox>
<GroupBox Header="Calibration" Grid.Row="1" Grid.ColumnSpan="2">
<Grid Name="grid_Calibration">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Calibration gain phase 1" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_cal1" Height="21" TextWrapping="Wrap" Text="nvm_cal1" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
<Label Content="Calibration gain phase 2" HorizontalAlignment="Left" Margin="0,20,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_cal2" Height="21" TextWrapping="Wrap" Text="nvm_cal2" HorizontalAlignment="Left" Margin="0,25,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
<Label Content="Calibration gain phase 3" HorizontalAlignment="Left" Margin="0,40,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_cal3" Height="21" TextWrapping="Wrap" Text="nvm_cal3" HorizontalAlignment="Left" Margin="0,45,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
</Grid>
</GroupBox>
</Grid>
</TabItem>
<TabItem x:Name="Tab_Safety_and_others_Settings" Header="Safety and Others settings">
<Grid Name="grid_Tab_and_safety">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="346*"/>
<ColumnDefinition Width="165*"/>
</Grid.ColumnDefinitions>
<GroupBox Header="Safety" Grid.Row="0" Grid.ColumnSpan="2">
<Grid Name="grid_Safety">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="ETH pin detection" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_buff_eth_On" GroupName="group_eth" Content="Enable" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True"/>
<RadioButton x:Name="radioButton_buff_eth_Off" GroupName="group_eth" Content="Disable" HorizontalAlignment="Left" Margin="100,5,0,0" VerticalAlignment="Top" Grid.Column="1"/>
...
...
</Grid>
</GroupBox>
<GroupBox Header="Wide range parameters" Grid.Row="1" Grid.ColumnSpan="2">
<Grid Name="grid_wild_range">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Inrush proportional coeff." HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_kp_iap" Height="23" TextWrapping="Wrap" Text="nvm_kp_iap" HorizontalAlignment="Left" Margin="0,3,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
...
</Grid>
</GroupBox>
</Grid>
</TabItem>
<TabItem x:Name="Tab_Traceability" Header="Traceability">
<Grid Name="grid_Traceability" Grid.ColumnSpan="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Production year (> 2020)" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<TextBox x:Name="textBox_buff_year" Height="23" TextWrapping="Wrap" Text="nvm_year" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="120" Grid.Column="1" />
...
</Grid>
</TabItem>
</TabControl>
</StackPanel>
</ScrollViewer>
</GroupBox>
</Grid>
</TabItem>
<TabItem x:Name="TabMonitor" Header="Monitoring">
<TabControl x:Name="tabControlmonitoring2" Margin="5,0,5,0">
...
<TabItem x:Name="Tab_Fault" Header="Fault Status">
<Grid Name="grid_Fault">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Short circuit fault" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0"/>
<RadioButton x:Name="radioButton_fltscc_On" GroupName="group_fltscc" Content="Enable" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="1" IsChecked="True" IsEnabled="False"/>
<RadioButton x:Name="radioButton_fltscc_Off" GroupName="group_fltscc" Content="Disable" HorizontalAlignment="Left" Margin="100,5,0,0" VerticalAlignment="Top" Grid.Column="1" IsEnabled="False"/>
...
</Grid>
</TabItem>
...
<TabItem x:Name="Tab_Diag" Header="Diagnostic Status">
<Grid Name="grid_Diag">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Label Content="Initial IDIAG current (mA)" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="2"/>
<TextBox x:Name="textBox_adcmsr_idiag1" Height="23" TextWrapping="Wrap" Text="adcmsr_idiag1" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="120" Grid.Column="2" IsEnabled="False" />
...
...
</Grid>
</TabItem>
</TabControl>
</TabItem>
</TabControl>
<GroupBox x:Name="group2" Header="Storing and sending configuration" Margin="10,0,10,79" VerticalAlignment="Bottom" Height="148">
<Grid Margin="2,0,-3,1">
<RadioButton x:Name="radio_conf_current" GroupName="conf_read" Content="Current conf" HorizontalAlignment="Left" Margin="8,5,0,0" VerticalAlignment="Top" IsChecked="True" FontSize="11" FontStyle="Italic" Checked="radio_conf_current_Checked" IsEnabled="False" Grid.ColumnSpan="2"/>
<RadioButton x:Name="radio_conf_modif" GroupName="conf_read" Content="Modifying" HorizontalAlignment="Left" Margin="97,5,0,0" VerticalAlignment="Top" FontSize="11" FontStyle="Italic" Checked="radio_conf_current_Checked" IsEnabled="False"/>
<Label x:Name="label_title" Content="Configuration title" HorizontalAlignment="Left" Margin="181,0,0,0" VerticalAlignment="Top" Width="106" FontStyle="Italic"/>
<TextBox x:Name="textBox_title" HorizontalAlignment="Left" Height="23" Margin="295,2,0,0" TextWrapping="Wrap" Text="conf_title" VerticalAlignment="Top" Width="129" FontStyle="Italic" FontSize="11" MaxLines="1" MaxLength="1000"/>
<Label x:Name="label_title_Corrupted" Content="" HorizontalAlignment="Left" Margin="439,2,0,0" VerticalAlignment="Top" Width="106" FontStyle="Italic"/>
<Label Content="List of available configurations :" HorizontalAlignment="Left" Margin="10,23,0,0" VerticalAlignment="Top"/>
<ListBox x:Name="listBox_config" HorizontalAlignment="Left" Height="70" Margin="18,43,0,0" VerticalAlignment="Top" Width="420" SelectionChanged="listBox_config_SelectionChanged"/>
<Button x:Name="btn_send_settings" Content="Send selected" HorizontalAlignment="Left" Margin="443,93,0,0" VerticalAlignment="Top" Width="109" Click="btn_send_settings_Click" IsEnabled="False" HorizontalContentAlignment="Center"/>
</Grid>
</GroupBox>
<Grid Margin="10,0,10,5" VerticalAlignment="Bottom">
...
...
</Grid>
</Grid>
</Window>

Related

Wpf how to shrink page in frame?

I researched on the form and there are already solutions but none of them worked for me. Belove screenshot to visualise the problem.
Main.xaml
<Frame x:Name="Main" Padding="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="95,86,0,10" NavigationUIVisibility="Hidden"/>
Account.xaml
<Page x:Class="Project.WPF.UI.Pages.Account"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Project.WPF.UI.Pages"
mc:Ignorable="d"
Height="auto" Width="auto"
Title="Account">
<Grid>
<Grid x:Name="gridTop" Margin="0,0,0,500">
<Button x:Name="btnEdit" Content="EDIT" HorizontalAlignment="Left" Margin="706,0,0,0" VerticalAlignment="Center" Height="46" Width="84"/>
<Button x:Name="btnDeleteAccount" Content="DELETE ACCOUNT" HorizontalAlignment="Left" VerticalAlignment="Center" Height="46" Width="167" Margin="400,0,0,0" />
<Button x:Name="btnSave" Content="SAVE" HorizontalAlignment="Left" Margin="599,0,0,0" VerticalAlignment="Center" Height="46" Width="84"/>
</Grid>
<Grid x:Name="gridMain" Margin="0,105,0,0">
<Label x:Name="lblUserName" Content="User Name" HorizontalAlignment="Left" Margin="68,27,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblName" Content="Name" HorizontalAlignment="Left" Margin="68,66,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblSurname" Content="Surname" HorizontalAlignment="Left" Margin="68,100,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblMembershipType" Content="Membership Type" HorizontalAlignment="Left" Margin="68,134,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblUserType" Content="UserType" HorizontalAlignment="Left" Margin="68,167,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblEmail" Content="Email" HorizontalAlignment="Left" Margin="68,201,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress1" Content="Address 1" HorizontalAlignment="Left" Margin="68,235,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress2" Content="Address 2" HorizontalAlignment="Left" Margin="68,269,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress3" Content="Address 3" HorizontalAlignment="Left" Margin="65,303,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblCity" Content="City" HorizontalAlignment="Left" Margin="65,337,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblState" Content="State" HorizontalAlignment="Left" Margin="65,371,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblCountry" Content="Country" HorizontalAlignment="Left" Margin="68,405,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblPostalCode" Content="PostalCode" HorizontalAlignment="Left" Margin="68,439,0,0" VerticalAlignment="Top" FontSize="22" FontFamily="Roboto Slab"/>
</Grid>
</Grid>
Main.xaml.cs
private void StackPanel_MouseLeftButtonUp(object sender, RoutedEventArgs e)
{
Main.NavigationService.Navigate(new Account());
}
How can a fit the account page in the frame? Even though window is maximised or resized, the account page will be fit in frame.
Thanks for your answer.
If you change Account.xaml on this way then it will be handeled the problem.
<Grid VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal">
<Button x:Name="btnDeleteAccount" Content="DELETE ACCOUNT" Height="46" Width="167"/>
<Button x:Name="btnSave" Content="SAVE" Margin="10,0,10,0" Height="46" Width="84"/>
<Button x:Name="btnEdit" Content="EDIT" Height="46" Width="84"/>
</StackPanel>
<Label x:Name="lblUserName" Grid.Row="1" Grid.Column="0" Content="User Name" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblName" Grid.Row="2" Grid.Column="0" Content="Name" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblSurname" Grid.Row="3" Grid.Column="0" Content="Surname" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblMembershipType" Grid.Row="4" Grid.Column="0" Content="Membership Type" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblUserType" Grid.Row="5" Grid.Column="0" Content="UserType" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblEmail" Grid.Row="6" Grid.Column="0" Content="Email" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress1" Grid.Row="7" Grid.Column="0" Content="Address 1" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress2" Grid.Row="8" Grid.Column="0" Content="Address 2" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblAddress3" Grid.Row="9" Grid.Column="0" Content="Address 3" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblCity" Grid.Row="10" Grid.Column="0" Content="City" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblState" Grid.Row="11" Grid.Column="0" Content="State" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblCountry" Grid.Row="12" Grid.Column="0" Content="Country" FontSize="22" FontFamily="Roboto Slab"/>
<Label x:Name="lblPostalCode" Grid.Row="13" Grid.Column="0" Content="PostalCode" FontSize="22" FontFamily="Roboto Slab"/>
<TextBox x:Name="txtUserName" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" TextWrapping="Wrap" Width="320" FontSize="20" Background="#FFECECEC"/>
<TextBox x:Name="txtName" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" TextWrapping="Wrap" Width="320" FontSize="20" Background="#FFECECEC"/>
<TextBox x:Name="txtSurName" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" TextWrapping="Wrap" Width="320" FontSize="20" Background="#FFECECEC"/>
<TextBox x:Name="txtMembershipType" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" TextWrapping="Wrap" Width="320" FontSize="20" Background="#FFECECEC"/>
<TextBox x:Name="txtUserType" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" TextWrapping="Wrap" Width="320" FontSize="20" Background="#FFECECEC"/>
<ComboBox x:Name="cmbEmail" Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" Width="320" FontSize="20" Background="#FFECECEC"/>
</Grid>

WPF/C# vertical Accordion control another way? [duplicate]

This question already has answers here:
WPF Clipping Problem
(2 answers)
WPF Transformations -- Rotating and switching width/height?
(3 answers)
Closed 5 years ago.
I try to do the horizontal accordion control to be a vertical control.
So I used a simple trick
<Controls:Accordion.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
<RotateTransform Angle="90"/>
</TransformGroup>
</Controls:Accordion.RenderTransform>
This is working fine, but the problem comes now.
When I resize the window or an element in the accordion control its all get broken. Its all change width is height and height is the width, but I'm not sure how to fix it.
I hope someone has an idea.
My whole code from Xaml
<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:WIHAAccordionTemplate"
xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit" x:Class="WIHAAccordionTemplate.MainWindow"
mc:Ignorable="d"
Title="MainWindow"
x:Name="parentControl"
Height="auto"
Width="auto"
WindowStartupLocation="CenterOwner"
WindowStyle="SingleBorderWindow"
SizeChanged="parentControl_SizeChanged"
Background="Green">
<Grid x:Name="childControl" Width="auto" Height="auto" SizeChanged="parentControl_SizeChanged">
<Controls:Accordion x:Name="AccordionControlTemplate" HorizontalAlignment="Center" Margin="0,0,0,0" MinHeight="500" MinWidth="300" Height="auto" Width="auto" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" SizeChanged="parentControl_SizeChanged">
<Controls:Accordion.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
<RotateTransform Angle="90"/>
</TransformGroup>
</Controls:Accordion.RenderTransform>
<Controls:AccordionItem x:Name="configItem" Header="Config" Style="{DynamicResource AccordionItemHeaderStyle}">
<Grid x:Name="configItemGrid" Style="{StaticResource GridStyleAccordion}">
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="parkingstationItem" Header="Parkingstation" Style="{DynamicResource AccordionItemHeaderStyle}">
<Grid x:Name="parkingStationItemGrid" Style="{StaticResource GridStyleAccordion}">
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="addNewUserItem" Header="add new User" Width="auto" Height="auto" Style="{DynamicResource AccordionItemHeaderStyle}" >
<Grid x:Name="addNewUserItemGrid" Style="{StaticResource GridStyleAccordion}" >
<Grid x:Name="userNew" MinWidth="200" MinHeight="200" Style="{StaticResource GridPosition}" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</Grid.RenderTransform>
<Label x:Name="nameN" Content="Benutzer:" HorizontalAlignment="Left" Margin="23,23,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="operatorIDN" Content="OperatorID:" HorizontalAlignment="Left" Margin="11,50,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="deviceIDN" Content="DeviceID:" HorizontalAlignment="Left" Margin="23,81,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="passwortN" Content="Passwort:" HorizontalAlignment="Left" Margin="21,110,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="aktivN" Content="Aktiv:" HorizontalAlignment="Left" Margin="45,139,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<TextBox x:Name="userTextBox" HorizontalAlignment="Left" Height="23" Margin="140,24,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<TextBox x:Name="operatorTextBox" HorizontalAlignment="Left" Height="23" Margin="140,51,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<TextBox x:Name="deviceTextBox" HorizontalAlignment="Left" Height="23" Margin="140,82,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<PasswordBox x:Name="passwordBox" HorizontalAlignment="Left" Height="23" Margin="140,111,0,0" VerticalAlignment="Top" Width="120"/>
<CheckBox x:Name="aktivCheckBox" HorizontalAlignment="Left" Margin="140,145,0,0" VerticalAlignment="Top"/>
<Button x:Name="button" Content="Save" Click="button_Click" HorizontalAlignment="Left" Margin="61,175,0,0" VerticalAlignment="Top" Style="{DynamicResource ButtonStyleWIHA}" />
</Grid>
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="userPanelItem" Header="User Panel" Style="{DynamicResource AccordionItemHeaderStyle}" IsSelected="True">
<Grid x:Name="userPanelItemGrid" Style="{StaticResource GridStyleAccordion}" >
<DataGrid x:Name="userDataGrid" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True" AlternatingRowBackground="{DynamicResource WihaGrauB}" ColumnWidth="auto" ColumnHeaderHeight="30" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="0,401,-111,-304" Width="auto" Height="auto">
<DataGrid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</DataGrid.RenderTransform>
<DataGrid.Columns>
<DataGridTextColumn Header="Benutzer" Binding="{Binding Name}" MinWidth="150" Width="auto" />
<DataGridTextColumn Header="OperatorID" Binding="{Binding OperatorID}" MinWidth="200" Width="auto"/>
<DataGridCheckBoxColumn Header="Aktiv" Binding="{Binding Aktiv}" MinWidth="50" Width="auto"/>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DockPanel>
<Image DockPanel.Dock="Left" Source="{Binding ImageUrl}" Height="30" Width="25" Margin="10,0,0,0"/>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Name: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="1" Margin="2,2,2,2"/>
<TextBox Text="{Binding Name}" Grid.Column="1" Width="150" TextAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" Margin="2,2,2,2" />
<TextBlock Text="OperatorID: " FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="2" FontWeight="Bold" Margin="2,2,2,2"/>
<TextBox x:Name="operatorText" Text="{Binding OperatorID}" Width="150" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" TextAlignment="Center" Margin="2,2,2,2" />
<TextBlock Text="DeviceID: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="3" Margin="2,2,2,2"/>
<TextBox Text="{Binding DeviceID}" Grid.Column="3" Width="150" HorizontalAlignment="Left" Grid.Row="3" TextAlignment="Center" Margin="2,2,2,2"/>
<TextBlock Text="Passwort: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="4" Margin="2,2,2,2"/>
<TextBox Text="{Binding Passwort}" Grid.Column="4" Width="150" HorizontalAlignment="Left" Grid.Row="4" TextAlignment="Center" Margin="2,2,2,2"/>
<TextBlock Text="Aktiv:" FontWeight="Bold" FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="5" Margin="2,2,2,2"/>
<CheckBox Grid.Column="5" Grid.Row="5" IsChecked="{Binding Aktiv}" Margin="2,2,2,2" />
</Grid>
</DockPanel>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="userloginItem" Width="auto" Height="auto" Header="Login" Style="{DynamicResource AccordionItemHeaderStyle}" >
<Grid x:Name="userLoginItemGrid" Style="{StaticResource GridStyleAccordion}">
<Grid x:Name="userLogin" Height="auto" Width="auto" Style="{StaticResource GridPosition}" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</Grid.RenderTransform>
<TextBox x:Name="usernameLoginTextBox" HorizontalAlignment="Center" Height="23" Margin="20,54,22,88" TextWrapping="Wrap" Text="" VerticalAlignment="Center" Width="120"/>
<Button x:Name="loginButton" Content="Login" Click="button_Click" HorizontalAlignment="Left" Margin="20,140,0,0" VerticalAlignment="Top" Style="{DynamicResource ButtonStyleWIHA}"/>
<PasswordBox x:Name="loginPasswordBox" HorizontalAlignment="Left" Margin="20,101,0,0" Width="120" Height="23" VerticalAlignment="Top"/>
<Label x:Name="label" Content="Benutzername:" HorizontalAlignment="Left" Margin="20,38,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="label1" Content="Passwort:" HorizontalAlignment="Left" Margin="20,85,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
</Grid>
</Grid>
</Controls:AccordionItem>
</Controls:Accordion>
</Grid>
and at the moment it looks like this
how it looks

How do I resize TextBox to fit the Window size when it Maximized/Minimized?

How can I resize my TextBoxe's/Label's to fit the window size when I maximize/minimize it? At this point textboxes just go to the center of the window. What I want that they resized to fit the grid columns and rows size. How can I do that? I tried to difine to what column and row textbox belongs, thougth, it will resize accordingly to ColumnDefinition, but that didn't change anything.
<DockPanel Margin="2,46,0,0" Name="dockPanel1" Width="Auto">
<TabControl Height="Auto" Name="tabControl1" Width="Auto" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DockPanel.Dock="Top">
<TabItem Header="tabItem1" Name="tabItem1">
<Grid Name="grid1" HorizontalAlignment="Center" VerticalAlignment="Top" Height="523" Width="766">
<Grid.RowDefinitions>
<RowDefinition MinHeight="0" Height="43*" />
<RowDefinition Height="45*" />
<RowDefinition Height="435*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="0" Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="100" />
<ColumnDefinition Width="385*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Grid.Row="0" Height="27" Name="textBox1" VerticalAlignment="Top" Margin="0,4,0,0" HorizontalAlignment="Right" Width="141" FontSize="14" HorizontalContentAlignment="Stretch" />
<Label Content="Label" Height="9" HorizontalAlignment="Left" Margin="16,7,0,0" Name="label1" VerticalAlignment="Top" Width="35" />
<Label Content="Supplier" Height="27" Name="label2" VerticalAlignment="Top" FontSize="14" FontFamily="Tahoma" FontWeight="Bold" Margin="6,4,0,0" Width="133" IsEnabled="True" HorizontalAlignment="Left" Foreground="Black" Background="White" />
<TextBox FontSize="14" Height="27" HorizontalAlignment="Stretch" Margin="140,6,0,0" Name="textBox11" VerticalAlignment="Top" Width="141" Grid.Row="1" />
<Label Content="Supplier Bank" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="6,6,142,0" Name="label3" VerticalAlignment="Top" Width="133" Grid.Row="1" Background="White" />
<TextBox FontSize="14" Height="27" HorizontalAlignment="Stretch" Margin="140,7,0,0" Name="textBox12" VerticalAlignment="Top" Width="141" Grid.Row="2" />
<Label Content="Account Number" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="6,7,142,0" Name="label4" VerticalAlignment="Top" Width="133" Grid.Row="2" Background="White" />
<TextBox FontSize="14" Height="27" Margin="134,4,110,0" Name="textBox2" VerticalAlignment="Top" Grid.Column="2" HorizontalAlignment="Stretch" Width="141" DataContext="{Binding ElementName=grid1, Path=ActualWidth}" />
<Label Content="Buyer" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="0,4,252,0" Name="label5" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Background="White" />
<TextBox FontSize="14" Grid.Row="1" Height="27" HorizontalAlignment="Left" Margin="134,6,0,0" Name="textBox3" VerticalAlignment="Top" Width="141" Grid.Column="2" />
<Label Content="Buyer Bank" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Grid.Row="1" Height="27" Margin="0,6,0,0" Name="label6" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Left" Background="White" />
<TextBox FontSize="14" Grid.Row="2" Height="27" HorizontalAlignment="Left" Margin="134,7,0,0" Name="textBox4" VerticalAlignment="Top" Width="141" Grid.Column="2" />
<Label Content="Account Number" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Grid.Row="2" Height="27" Margin="0,7,0,0" Name="label7" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Left" Background="White" />
</Grid>
</TabItem>
<TabControl.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0.035" />
<GradientStop Color="#FF1B327A" Offset="0.528" />
<GradientStop Color="#FF001E98" Offset="0.278" />
</LinearGradientBrush>
</TabControl.Background>
</TabControl>
</DockPanel>
Dont use a static value for the width attribute.
You can try "HorizontalAlignment=Stretch".

Xaml Scrollviewer not showing the full Grid content

I made a product page but the scrollviewer does not show everything that is in that grid. I have a feeling that is has something to do with my row definitions I hope someone can help me
XAML:
<Page
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Height="729.552">
<Page.Resources>
</Page.Resources>
<Grid x:Name="LayoutRoot" d:DataContext="{d:DesignData /SampleData/RootObjectSampleData2.xaml}" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<!--TODO: Content should be placed within the following grid-->
<Grid x:Name="ContentPanel" HorizontalAlignment="Left" VerticalAlignment="Top">
<Pivot x:Name="ProductHub" HorizontalAlignment="Left" VerticalAlignment="Top">
<PivotItem x:Name="ProductPivot" Header="Item" DataContext="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Top" Height="680">
<ScrollViewer Width="336" Height="670" HorizontalAlignment="Left" VerticalAlignment="Top" >
<Grid x:Name="ContentGrid" Height="auto" Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="auto" MinHeight="278"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="auto" MinHeight="251"/>
<RowDefinition Height="77*"/>
<RowDefinition Height="34*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="TBlockTitle" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding result.item.title}" VerticalAlignment="Top" Height="20" d:DataContext="{d:DesignData /SampleData/RootObjectSampleData.xaml}"/>
<Image x:Name="ImageProduct" HorizontalAlignment="Left" Height="160" Margin="10,49,0,0" VerticalAlignment="Top" Width="316" Stretch="Fill" Source="{Binding result.item.images.Item330}" Tapped="ImgProduct_Click" />
<TextBlock x:Name="BtnFavorite" HorizontalAlignment="Left" Margin="10,214,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" FontFamily="Segoe MDL2 Assets" FontSize="20" Height="20" Width="20" />
<TextBlock x:Name="TBlockHiddenSEO" HorizontalAlignment="Left" Margin="298,10,-6,0" TextWrapping="Wrap" Text="{Binding result.item.seo_name}" VerticalAlignment="Top" Opacity="0" Height="40" Width="44"/>
<TextBlock x:Name="textBlockCurrency" HorizontalAlignment="Left" Margin="192,218,0,0" TextWrapping="Wrap" Text="{Binding result.item.currency_symbol}" VerticalAlignment="Top" Height="20" Width="8"/>
<TextBlock x:Name="textBlockPrice" HorizontalAlignment="Left" Margin="205,218,0,0" TextWrapping="Wrap" Text="{Binding result.item.price}" VerticalAlignment="Top" Height="20" Width="28"/>
<TextBlock x:Name="textBlockLookAmmount" HorizontalAlignment="Left" Margin="10,258,0,0" TextWrapping="Wrap" Text="{Binding result.item.views}" VerticalAlignment="Top" Height="20" Width="16" d:DataContext="{d:DesignData /SampleData/RootObjectSampleData.xaml}"/>
<TextBlock x:Name="textBlockWatchedText" HorizontalAlignment="Left" Margin="31,258,0,0" TextWrapping="Wrap" Text="x bekeken sinds" VerticalAlignment="Top" Height="20" Width="105"/>
<TextBlock x:Name="textBlockDate" HorizontalAlignment="Left" Margin="141,258,0,0" TextWrapping="Wrap" Text="{Binding result.item.placed}" VerticalAlignment="Top" Height="20" Width="81" d:DataContext="{d:DesignData /SampleData/RootObjectSampleData.xaml}"/>
<StackPanel x:Name="StPanelUser" Grid.Row="1" Margin="0,10,0,20"/>
<TextBlock x:Name="textBlockDescription" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding result.item.description}" VerticalAlignment="Top" Width="316" Grid.Row="1"/>
<TextBlock x:Name="textBlockShipping" HorizontalAlignment="Left" Margin="10,1,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Shipping" VerticalAlignment="Top" Height="20" Width="59"/>
<TextBlock x:Name="textBlockState" HorizontalAlignment="Left" Margin="10,26,0,0" Grid.Row="2" TextWrapping="Wrap" Text="State" VerticalAlignment="Top" Height="20" Width="59"/>
</Grid>
</ScrollViewer>
</PivotItem>
</Pivot>
</Grid>
<ProgressRing HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="ProgressRing"/>
</Grid>
Thank you
I'm pretty sure, that the parent element of your scrollviewer has a smaller height than the scrollviewer itself - the height of the scrollviewer sets the height of the control, not the heigh of the content...
As consequence, if the scrollviewer is 200px greater than the parent control - the last 200px of the scrollviewer are cut off
Remove Height="670" in the ScrollViewer. If you set the height for a ScrollViewer, then it displays the controls that fits in the given height
<ScrollViewer Width="336" HorizontalAlignment="Left" VerticalAlignment="Top" >
....
....
</ScrollViewer>
.
<Window x:Class="minimizeApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid >
<ScrollViewer Width="336" HorizontalAlignment="Left" VerticalAlignment="Top" >
<Grid x:Name="ContentGrid" Height="auto" Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="auto" MinHeight="278"/>
<RowDefinition Height="30*"/>
<RowDefinition Height="auto" MinHeight="251"/>
<RowDefinition Height="77*"/>
<RowDefinition Height="34*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="TBlockTitle" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="title" VerticalAlignment="Top" Height="20" />
<Image x:Name="ImageProduct" HorizontalAlignment="Left" Height="160" Margin="10,49,0,0" VerticalAlignment="Top" Width="316" Stretch="Fill" Source="Images/graph1.jpg" />
<TextBlock x:Name="BtnFavorite" HorizontalAlignment="Left" Margin="10,214,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" FontFamily="Segoe MDL2 Assets" FontSize="20" Height="20" Width="20" />
<TextBlock x:Name="TBlockHiddenSEO" HorizontalAlignment="Left" Margin="298,10,-6,0" TextWrapping="Wrap" Text="name" VerticalAlignment="Top" Opacity="0" Height="40" Width="44"/>
<TextBlock x:Name="textBlockCurrency" HorizontalAlignment="Left" Margin="192,218,0,0" TextWrapping="Wrap" Text="currency" VerticalAlignment="Top" Height="20" Width="8"/>
<TextBlock x:Name="textBlockPrice" HorizontalAlignment="Left" Margin="205,218,0,0" TextWrapping="Wrap" Text="price" VerticalAlignment="Top" Height="20" Width="28"/>
<TextBlock x:Name="textBlockLookAmmount" HorizontalAlignment="Left" Margin="10,258,0,0" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="16" />
<TextBlock x:Name="textBlockWatchedText" HorizontalAlignment="Left" Margin="31,258,0,0" TextWrapping="Wrap" Text="x bekeken sinds" VerticalAlignment="Top" Height="20" Width="105"/>
<TextBlock x:Name="textBlockDate" HorizontalAlignment="Left" Margin="141,258,0,0" TextWrapping="Wrap" Text="placed" VerticalAlignment="Top" Height="20" Width="81" />
<StackPanel x:Name="StPanelUser" Grid.Row="1" Margin="0,10,0,20"/>
<TextBlock x:Name="textBlockDescription" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="description" VerticalAlignment="Top" Width="316" Grid.Row="1"/>
<TextBlock x:Name="textBlockShipping" HorizontalAlignment="Left" Margin="10,1,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Shipping" VerticalAlignment="Top" Height="20" Width="59"/>
<TextBlock x:Name="textBlockState" HorizontalAlignment="Left" Margin="10,26,0,0" Grid.Row="2" TextWrapping="Wrap" Text="State" VerticalAlignment="Top" Height="20" Width="59"/>
<TextBlock x:Name="textBlockpayment" HorizontalAlignment="Left" Margin="10,51,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Payment" VerticalAlignment="Top" Height="20" Width="72"/>
<TextBlock x:Name="textBlockType" HorizontalAlignment="Left" Margin="10,76,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Type" VerticalAlignment="Top" Height="20" Width="59"/>
<TextBlock x:Name="textBlockRole" HorizontalAlignment="Left" Margin="10,101,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Role" VerticalAlignment="Top" Height="20" Width="59"/>
<TextBlock x:Name="textBlockShipping_FillIn" HorizontalAlignment="Left" Margin="141,1,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockState_FillIn" HorizontalAlignment="Left" Margin="141,26,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockpayment_FillIn" HorizontalAlignment="Left" Margin="141,51,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockType_FillIn" HorizontalAlignment="Left" Margin="141,76,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockRole_FillIn" HorizontalAlignment="Left" Margin="141,101,0,0" Grid.Row="2" TextWrapping="Wrap" Text="1323" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockAdvertiser" HorizontalAlignment="Left" Margin="10,149,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Adverteerder" VerticalAlignment="Top" Height="20" Width="87"/>
<TextBlock x:Name="textBlockLocation" HorizontalAlignment="Left" Margin="10,174,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Locatie" VerticalAlignment="Top" Height="20" Width="87"/>
<TextBlock x:Name="textBlockPhone" HorizontalAlignment="Left" Margin="10,231,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Telefoon" VerticalAlignment="Top" Height="20" Width="87"/>
<TextBlock x:Name="textBlockAdvertiser_FillIn" HorizontalAlignment="Left" Margin="141,149,0,0" Grid.Row="2" TextWrapping="Wrap" Text="name" VerticalAlignment="Top" Height="20" Width="37"/>
<TextBlock x:Name="textBlockLocation_FillIn" HorizontalAlignment="Left" Margin="141,174,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="8"/>
<TextBlock x:Name="textBlockProvince_FillIn" HorizontalAlignment="Left" Margin="141,199,0,0" Grid.Row="2" TextWrapping="Wrap" Text="123" VerticalAlignment="Top" Height="20" Width="0"/>
<TextBlock x:Name="textBlockPhone_FillIn" HorizontalAlignment="Left" Margin="141,231,0,0" Grid.Row="2" TextWrapping="Wrap" Text="phone" VerticalAlignment="Top" Height="20"/>
</Grid>
</ScrollViewer>
</Grid>
</Window>

How to make Grid control scroll?

How to make this code scroll'able?
I've tried this solution but it won't work: Need to scroll one WPF Grid
My XAML (Grid named Photos has to scroll):
<Grid Height="533" VerticalAlignment="Bottom">
<TextBox x:Name="siteAdressTextBox" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="http://www.etrapez.pl/" VerticalAlignment="Top" Width="215"/>
<Button x:Name="sendWebRequestButton" Content="Wyślij zapytanie" HorizontalAlignment="Left" Margin="10,38,0,0" VerticalAlignment="Top" Width="107" Click="webRequest"/>
<Button Content="Pobierz wszystko" HorizontalAlignment="Left" Margin="122,38,0,0" VerticalAlignment="Top" Width="103" Click="downThemAll"/>
<ScrollViewer HorizontalAlignment="Left" Height="460" Margin="10,63,0,0" VerticalAlignment="Top" Width="1000" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" CanContentScroll="True">
<Grid x:Name="Photos" HorizontalAlignment="Left" Height="460" VerticalAlignment="Top" Width="1000" ShowGridLines="False" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible" />
</ScrollViewer>
<TextBox Name="InfoBoxLabel" IsReadOnly="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Height="48" Margin="230,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="300"/>
</Grid>
try this
<Grid Height="533" VerticalAlignment="Bottom">
<TextBox x:Name="siteAdressTextBox" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="http://www.etrapez.pl/" VerticalAlignment="Top" Width="215"/>
<Button x:Name="sendWebRequestButton" Content="Wyślij zapytanie" HorizontalAlignment="Left" Margin="10,38,0,0" VerticalAlignment="Top" Width="107"/>
<Button Content="Pobierz wszystko" HorizontalAlignment="Left" Margin="122,38,0,0" VerticalAlignment="Top" Width="103" />
<ScrollViewer HorizontalAlignment="Left" Height="460" Margin="10,63,0,0" VerticalAlignment="Top" Width="1000" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
<Grid x:Name="Photos" ShowGridLines="False">
<TextBlock TextWrapping="Wrap" Text="text here"/>
</Grid>
</ScrollViewer>
<TextBox Name="InfoBoxLabel" IsReadOnly="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Height="48" Margin="230,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="300"/>
</Grid>
Output will be http://prntscr.com/3w0cr9

Categories

Resources