Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Problem with mainwindow grid layout and datagridview -- no horizontal scrollbar -- how to fix?

$
0
0

Here is a pictures of what I have -- followed by the xaml.  Any suggestions how to fix greatly appreciated.  The textboxes way too far to the right of the window.  How to adjust the xaml?  How to add scrollbar(s) to datagridview

<Window x:Class="WPFWithWFAndDatabinding.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        Title="MainWindow" Loaded="Window_Loaded"><Grid x:Name="mainGrid"><Grid.Resources><DataTemplate x:Key="ListItemsTemplate"><TextBlock Text="{Binding Path=ContactName}"/></DataTemplate></Grid.Resources><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1"><Label Margin="20,38,5,2">First Name:</Label><Label Margin="20,0,5,2">Company Name:</Label><Label Margin="20,0,5,2">Phone:</Label><Label Margin="20,0,5,2">Address:</Label><Label Margin="20,0,5,2">City:</Label><Label Margin="20,0,5,2">Region:</Label><Label Margin="20,0,5,2">Postal Code:</Label></StackPanel><StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0"><Label Margin="20,5,5,0">List of Customers:</Label><ListBox x:Name="listBox1" Height="200" Width="200" HorizontalAlignment="Left" 
			   ItemTemplate="{StaticResource ListItemsTemplate}" IsSynchronizedWithCurrentItem="True" Margin="20,5,5,5"/></StackPanel><StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="2"><TextBox Margin="5,38,5,2" Width="200" Text="{Binding Path=ContactName}"/><TextBox Margin="5,0,5,2" Width="200" Text="{Binding Path=CompanyName}"/><TextBox Margin="5,0,5,2" Width="200" Text="{Binding Path=Phone}"/><TextBox Margin="5,0,5,2" Width="200" Text="{Binding Path=Address}"/><TextBox Margin="5,0,5,2" Width="200" Text="{Binding Path=City}"/><TextBox Margin="5,0,5,2" Width="30" HorizontalAlignment="Left" Text="{Binding Path=Region}"/><TextBox Margin="5,0,5,2" Width="50" HorizontalAlignment="Left" Text="{Binding Path=PostalCode}"/></StackPanel><WindowsFormsHost Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="20,5,5,5" Height="300"><wf:DataGridView x:Name="dataGridView1"/></WindowsFormsHost></Grid></Window>
Thanks


Rich P


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>