Prakash Prajapati

Prakash Prajapati

  • 1.8k
  • 163
  • 1.2k

How to make responsive design in wpf ?

May 5 2020 12:23 AM
Hello All,
 
I have facing issue regarding reposinve design using wpf. but I had not find any specific solution yet.
 
I had taken one window WPF page and inner taken MdiContainer child page container.
 
MainWindow.xaml
 
<ScrollViewer Name="scrollViewer" VerticalScrollBarVisibility="Auto">
<mdi:MdiContainer Name="Container" Theme="Generic">
<mdi:MdiChild Name="ChildWindowContent" WindowState="Maximized" />
</mdi:MdiContainer>
</ScrollViewer>
 
and after I had aslo taken Usercontrol named
 
_CaptureLogsUserControl.xaml
 
<ScrollViewer Name="scrollViewer" VerticalScrollBarVisibility="Auto">
<DockPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Style="{StaticResource PanelSaveStyle}" Width="1037" Margin="0,0,15,0" >
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="1" Grid.Row="17" Margin="10,0,0,0" >
<Label x:Name="LabelXMLPath" Width="150" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_SELECT_XMLFILE], FallbackValue={x:Static p:UIResources.LABEL_SELECT_XMLFILE}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,6"/>
<TextBlock Style="{StaticResource ColonStyle}" Text=":" />
<local:_ToolTipUserControl ToolTip="{Binding Source={StaticResource localisation }, Mode=OneWay, Path=.[UIResources.TOOLTIP_SELECT_CONFIG_FILE]}" />
</StackPanel>
<TextBox x:Name="XMLPathField" MaxLength="1000" Style="{StaticResource TextBoxStyle}" Margin="10,10,0,11" Width="700" />
<Button Content="{Binding Source={StaticResource localisation}, Mode=OneWay,FallbackValue='{ x:Static p:UIResources.BUTTON_BROWSEXML}', Path=.[UIResources.BUTTON_BROWSEXML]}" Style="{StaticResource ButtonPrimary}" Name="BrowseXML" Click="BrowseXML_Click" Margin="5,10,5,11" Width="100" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Style="{StaticResource PanelSaveStyle}" Width="1037" Margin="0,0,15,0">
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="1" Grid.Row="17" Margin="10,0,0,0" >
<Label x:Name="LabelZip" Width="150" HorizontalContentAlignment="Right" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_ZIP_FILE_PATH], FallbackValue={x:Static p:UIResources.LABEL_SELECT_XMLFILE}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,6"/>
<TextBlock Style="{StaticResource ColonStyle}" Text=":" />
<local:_ToolTipUserControl ToolTip="{Binding Source={StaticResource localisation }, Mode=OneWay, Path=.[UIResources.TOOLTIP_SELECT_OUTPUT_FILE_PATH]}" />
</StackPanel>
<TextBox x:Name="ZipFilePathField" MaxLength="1000" Style="{StaticResource TextBoxStyle}" Margin="10,10,0,11" Width="700" />
<Button Content="{Binding Source={StaticResource localisation}, Mode=OneWay,FallbackValue='{ x:Static p:UIResources.BUTTON_BROWSEXML}', Path=.[UIResources.BUTTON_BROWSEXML]}" Style="{StaticResource ButtonPrimary}" Name="BrowseSavePath" Click="BrowseSavePath_Click" Margin="5,10,5,11" Width="100" />
</StackPanel>
<GroupBox Name="CaptureLogsGroupBox" Grid.Row="2" Style="{StaticResource GroupStyle}">
<DockPanel>
<Label Name="CaptureLogsLabel" DockPanel.Dock="Top" Style="{StaticResource LabelHeaderStyle}" Content="{Binding Source={StaticResource localisation},
FallbackValue='{ x:Static p:UIResources.LABEL_CAPTURE_LOGS}', Mode=OneWay, Path=.[UIResources.LABEL_CAPTURE_LOGS]}"></Label>
<Grid Width="920" Height="Auto" DockPanel.Dock="Bottom" Margin="0 15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="260"/>
<ColumnDefinition Width="260"/>
<ColumnDefinition Width="260"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="0" >
<CheckBox Name="EventLogsCheckBox" Unchecked="EventLogsCheckBox_Unchecked" Checked="EventLogsCheckBox_Checked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Name="EventLogsLabel" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_EVENT_LOGS}',
Mode=OneWay, Path=.[UIResources.LABEL_EVENT_LOGS]}"></Label>
</CheckBox>
</StackPanel>
<CheckBox Name="applicationEventLogCheckBox" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_APPLICATION]}">
</TextBlock>
</CheckBox>
<CheckBox Name="systemEventLogCheckBox" Grid.Column="2" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SYSTEM]}">
</TextBlock>
</CheckBox>
<CheckBox Name="sedcoEventLogCheckBox" Grid.Column="3" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SEDCO]}">
</TextBlock>
</CheckBox>
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" >
<CheckBox Name="DatabaseTablesCheckBox" Checked="DatabaseTablesCheckBox_Checked" Unchecked="DatabaseTablesCheckBox_Unchecked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Name="DatabaseTablesLabel" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_DATABASE_TABLES}',
Mode=OneWay, Path=.[UIResources.LABEL_DATABASE_TABLES]}" ></Label>
</CheckBox>
</StackPanel>
<CheckBox Name="exceptionDatabaseTablesCheckBox" Grid.Column="1" Grid.Row="4" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_EXCEPTION]}">
</TextBlock>
</CheckBox>
<CheckBox Name="moduleDatabaseTablesCheckBox" Grid.Column="2" Grid.Row="4" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_MODULE]}">
</TextBlock>
</CheckBox>
<CheckBox Name="systemSettingsDatabaseTablesCheckBox" Grid.Column="3" Grid.Row="4" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SYSTEM_SETTINGS]}">
</TextBlock>
</CheckBox>
<CheckBox Name="systemSettingsDatabaseTablesAuditLogsCheckBox" Grid.Column="1" Grid.Row="5" Margin="10,10,0,8" FlowDirection="LeftToRight">
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SYSTEM_SETTINGS_AUDITLOGS]}">
</TextBlock>
</CheckBox>
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="1" Grid.Row="6" Margin="10,0,0,0" >
<Label x:Name="RequestTimeOutField" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_ADDITIONAL_TABLES], FallbackValue={x:Static p:UIResources.LABEL_ADDITIONAL_TABLES}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,6"/>
<TextBlock Style="{StaticResource ColonStyle}" Text=":" />
<local:_ToolTipUserControl ToolTip="{Binding Source={StaticResource localisation }, Mode=OneWay, Path=.[UIResources.TOOLTIP_ADDITIONAL_TABLES]}" />
</StackPanel>
<TextBox LostFocus="AddtionalTableField_LostFocus" FocusManager.FocusedElement="{Binding ElementName=AddtionalTableField}" Name="AddtionalTableField" MaxLength="1000" Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="3" Style="{StaticResource TextBoxStyle}" Margin="155,0,0,0" Width="586" ></TextBox>
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="2" >
<CheckBox Name="InstallerCheckBox" Checked="InstallerCheckBox_Checked" Unchecked="InstallerCheckBox_Unchecked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Padding="0 0 0 0" Name="InstallerLogFilesLabel" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_INSTALLER_LOGS}',
Mode=OneWay, Path=.[UIResources.LABEL_INSTALLER_LOGS]}"></Label>
</CheckBox>
</StackPanel>
<RadioButton Checked="InstallerLogTopRadioButton_Checked" Name="InstallerLogTopRadioButton" Grid.Column="1" Grid.Row="8" Margin="10,5,0,0" GroupName="installerGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_TOP]}">
</TextBlock>
</RadioButton>
<TextBox Name="TopInstallerLogField" MaxLength="5" Grid.Column="2" Grid.Row="8" Grid.ColumnSpan="3" Style="{StaticResource TextBoxStyle}" Margin="0,0,0,0" Width="200" ></TextBox>
<Label x:Name="labelInstallerLogFiles" Grid.Column="2" Grid.Row="8" Grid.ColumnSpan="2" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_INSTALLER_LOGS], FallbackValue={x:Static p:UIResources.LABEL_INSTALLER_LOGS}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,5,210,7" />
<RadioButton Name="InstallerLogDateRangeRadioButton" Checked="InstallerLogDateRangeRadioButton_Checked" Grid.Column="1" Grid.Row="9" Margin="10,5,0,0" GroupName="installerGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SELECT_DATE_RANGE]}">
</TextBlock>
</RadioButton>
<DatePicker Grid.Column="2" Loaded="DatePickerStartDate_Loaded" Grid.Row="9" Height="25" HorizontalAlignment="Left" Margin="0,10,0,10" Name="datePickerInstallerStartDate" VerticalAlignment="Top" Width="200" />
<DatePicker Grid.Column="3" Loaded="DatePickerEndDate_Loaded" Grid.Row="9" Height="25" HorizontalAlignment="Left" Margin="0,10,0,0" Name="datePickerInstallerEndDate" VerticalAlignment="Top" Width="200" />
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="10" Grid.ColumnSpan="2" >
<CheckBox Name="IISCheckBox" Checked="IISCheckBox_Checked" Unchecked="IISCheckBox_Unchecked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Padding="0 0 0 0" Name="IISLogFilesLabel" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_IIS_LOGS}',
Mode=OneWay, Path=.[UIResources.LABEL_IIS_LOGS]}" Margin="0,0,0,0" VerticalAlignment="Top"></Label>
</CheckBox>
</StackPanel>
<RadioButton Name="IISLogTopRadioButton" Checked="IISLogTopRadioButton_Checked" Grid.Column="1" Grid.Row="11" Margin="10,5,0,0" GroupName="IISGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_TOP]}">
</TextBlock>
</RadioButton>
<TextBox Name="TopIISLogField" MaxLength="5" Grid.Column="2" Grid.Row="11" Grid.ColumnSpan="3" Style="{StaticResource TextBoxStyle}" Margin="0,0,0,0" Width="200" ></TextBox>
<Label x:Name="labelIISLogFiles" Grid.Column="2" Grid.Row="11" Grid.ColumnSpan="2" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_IIS_LOGS], FallbackValue={x:Static p:UIResources.LABEL_IIS_LOGS}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,5,240,7" />
<RadioButton Name="IISLogDateRangeRadioButton" Checked="IISLogDateRangeRadioButton_Checked" Grid.Column="1" Grid.Row="12" Margin="10,5,0,0" GroupName="IISGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SELECT_DATE_RANGE]}">
</TextBlock>
</RadioButton>
<DatePicker Loaded="DatePickerStartDate_Loaded" Grid.Column="2" Grid.Row="12" Height="25" HorizontalAlignment="Left" Margin="0,10,0,10" Name="datePickerIISStartDate" VerticalAlignment="Top" Width="200" />
<DatePicker Loaded="DatePickerEndDate_Loaded" Grid.Column="3" Grid.Row="12" Height="25" HorizontalAlignment="Left" Margin="0,10,0,0" Name="datePickerIISEndDate" VerticalAlignment="Top" Width="200" />
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="13" Grid.ColumnSpan="2" >
<CheckBox Name="AppicationTraceCheckBox" Checked="AppicationTraceCheckBox_Checked" Unchecked="AppicationTraceCheckBox_Unchecked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Padding="0 0 0 0" Name="ApplicationTraceLabel" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_TRACE_FILES}',
Mode=OneWay, Path=.[UIResources.LABEL_TRACE_FILES]}"></Label>
</CheckBox>
</StackPanel>
<RadioButton Name="ApplicationTraceTopRadioButton" Checked="ApplicationTraceTopRadioButton_Checked" Grid.Column="1" Grid.Row="14" Margin="10,5,0,0" GroupName="applicationTraceGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_TOP]}">
</TextBlock>
</RadioButton>
<TextBox Name="topApplicationTraceLogField" MaxLength="5" Grid.Column="2" Grid.Row="14" Grid.ColumnSpan="3" Style="{StaticResource TextBoxStyle}" Margin="0,0,0,0" Width="200" ></TextBox>
<Label x:Name="labelApplicationTraceLogFiles" Grid.Column="2" Grid.Row="14" Grid.ColumnSpan="2" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_TRACE_FILES], FallbackValue={x:Static p:UIResources.LABEL_TRACE_FILES}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,5,170,7" />
<RadioButton Name="ApplicationTraceDateRangeRadioButton" Checked="ApplicationTraceDateRangeRadioButton_Checked" Grid.Column="1" Grid.Row="15" Margin="10,5,0,0" GroupName="applicationTraceGroup" >
<TextBlock Style="{StaticResource CheckBoxTextblockStyle}" Text="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[UIResources.LABEL_SELECT_DATE_RANGE]}">
</TextBlock>
</RadioButton>
<DatePicker Loaded="DatePickerStartDate_Loaded" Grid.Column="2" Grid.Row="15" Height="25" HorizontalAlignment="Left" Margin="0,10,0,10" Name="datePickerApplicationTraceStartDate" VerticalAlignment="Top" Width="200" />
<DatePicker Loaded="DatePickerEndDate_Loaded" Grid.Column="3" Grid.Row="15" Height="25" HorizontalAlignment="Left" Margin="0,10,0,0" Name="datePickerApplicationTraceEndDate" VerticalAlignment="Top" Width="200" />
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="0" Grid.Row="16" Grid.ColumnSpan="2" >
<CheckBox Name="MiscellaneousTraceCheckBox" Checked="MiscellaneousTraceCheckBox_Checked" Unchecked="MiscellaneousTraceCheckBox_Unchecked" Grid.Column="1" Grid.Row="1" Margin="10,10,0,8" FlowDirection="LeftToRight">
<Label Padding="0 0 0 0" Name="Miscelleneous" Style="{StaticResource BoldLabelTypeLeft}" Content="{Binding Source={StaticResource localisation }, FallbackValue='{ x:Static p:UIResources.LABEL_MISCELLANEOUS}',
Mode=OneWay, Path=.[UIResources.LABEL_MISCELLANEOUS]}"></Label>
</CheckBox>
</StackPanel>
<StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="1" Grid.Row="17" Margin="10,0,0,0" >
<Label x:Name="LabelAdditionalFiles" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_ADDTIONAL_FILES], FallbackValue={x:Static p:UIResources.LABEL_ADDTIONAL_FILES}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,6"/>
<TextBlock Style="{StaticResource ColonStyle}" Text=":" />
<local:_ToolTipUserControl ToolTip="{Binding Source={StaticResource localisation }, Mode=OneWay, Path=.[UIResources.TOOLTIP_ADDITIONAL_FILES]}" />
</StackPanel>
<TextBox Name="AddtionalFilesField" Height="50" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" MaxLength="1000" Grid.Column="1" Grid.Row="17" Grid.ColumnSpan="3" Style="{StaticResource TextBoxStyle}" Margin="144,0,0,0" Width="598" ></TextBox>
</Grid>
</DockPanel>
</GroupBox>
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="3" Style="{StaticResource PanelSaveStyle}" Width="480" Margin="0,0,0,0">
<Button Content="{Binding Source={StaticResource localisation}, Mode=OneWay,
FallbackValue='{ x:Static p:UIResources.BUTTON_GENERATE_ZIP}', Path=.[UIResources.BUTTON_GENERATE_ZIP]}" Style="{StaticResource ButtonPrimary}" Name="GenerateZipButton" Margin="5,6" Width="155" Click="GenerateZipButton_Click" />
<Button Content="{Binding Source={StaticResource localisation}, Mode=OneWay,
FallbackValue='{ x:Static p:UIResources.BUTTON_GENERATE_ZIP}', Path=.[UIResources.LABEL_GENERATE_CONFIGURAITION_FILE]}" Style="{StaticResource ButtonPrimary}" Name="GenerateConfigurationFileButton" Margin="5,6" Width="200" Click="GenerateConfigurationFileButton_Click" />
<Button Content="{Binding Source={StaticResource localisation}, FallbackValue='{ x:Static p:UIResources.BUTTON_CANCEL}',
Mode=OneWay, Path=.[UIResources.BUTTON_CANCEL]}" Style="{StaticResource ButtonCancel}" Name="CancelButton" Click="CancelButton_Click" />
</StackPanel>
</Grid>
</DockPanel>
</ScrollViewer>
 
When I run this WPF application at that time I had got double scrollbar.
 
but my scenario I have not need inner scollbar.
 
I had make lots of RND to remove Inner scollbar with responsive design but I had not find any specific solution yet.
 
if any have solution regarding it then please help me.
Thanks in advance

Answers (1)