Hi There
I am trying to scroll a listview control in WPF which is embedded in a Grid layout control. I can't seem to achieve this. Any ideas anyone?
By the way i have set the following properties on the list view in the xaml markup:
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!--Top Area-->
<GroupBox Grid.Row="0" Header="Price, Volume and Ratio Stats">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!--Row 1-->
<TextBlock x:Name="tbSellInstrumentCode" Grid.Column="0" Grid.Row="0">Sell Share</TextBlock>
<TextBox x:Name="txtSellInstrumentCode" Grid.Column="1" Grid.Row="0" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbBuyInstrumentCode" Grid.Column="2" Grid.Row="0">Buy Share</TextBlock>
<TextBox x:Name="txtBuyInstrumentCode" Grid.Column="3" Grid.Row="0" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbTargetPriceRatio" Grid.Column="4" Grid.Row="0">Target Trigger</TextBlock>
<TextBox x:Name="txtTargetPriceRatio" Grid.Column="5" Grid.Row="0" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbTradedPriceRatio" Grid.Column="6" Grid.Row="0">Traded Price Ratio</TextBlock>
<TextBox x:Name="txtTradedPriceRatio" Grid.Column="7" Grid.Row="0" IsEnabled="False"></TextBox>
<!--Row 2-->
<TextBlock x:Name="tbBidPrice" Grid.Column="0" Grid.Row="1">Bid Price</TextBlock>
<TextBox x:Name="txtBidPrice" Grid.Column="1" Grid.Row="1" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbAskPrice" Grid.Column="2" Grid.Row="1">Ask Price</TextBlock>
<TextBox x:Name="txtAskPrice" Grid.Column="3" Grid.Row="1" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbMarketPriceRatio" Grid.Column="4" Grid.Row="1">Market Trigger</TextBlock>
<TextBox x:Name="txtMarketPriceRatio" Grid.Column="5" Grid.Row="1" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbTradedVolumeRatio" Grid.Column="6" Grid.Row="1">Traded Volume Ratio</TextBlock>
<TextBox x:Name="txtTradedVolumeRatio" Grid.Column="7" Grid.Row="1" IsEnabled="False"></TextBox>
<!--Row 3-->
<TextBlock x:Name="tbBidVolume" Grid.Column="0" Grid.Row="2">Bid Volume</TextBlock>
<TextBox x:Name="txtBidVolume" Grid.Column="1" Grid.Row="2" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbAskVolume" Grid.Column="2" Grid.Row="2">Ask Volume</TextBlock>
<TextBox x:Name="txtAskVolume" Grid.Column="3" Grid.Row="2" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbTradedSpread" Grid.Column="4" Grid.Row="2">Traded Spread</TextBlock>
<TextBox x:Name="txtTradedSpread" Grid.Column="5" Grid.Row="2" IsEnabled="False"></TextBox>
<TextBlock x:Name="tbTradedAmountRatio" Grid.Column="6" Grid.Row="2">Traded Amount Ratio</TextBlock>
<TextBox x:Name="txtTradedAmountRatio" Grid.Column="7" Grid.Row="2" IsEnabled="False"></TextBox>
</Grid>
</GroupBox>
<!--Middle Area-->
<GroupBox Grid.Row="1" Header="Average Price, Total Volumes and Averages Stats">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!--Row 1-->
<TextBlock Grid.Column="0" Grid.Row="0">Total Sell Volume</TextBlock>
<TextBox x:Name="txtTotalSellVolume" Grid.Column="1" Grid.Row="0" IsEnabled="False"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="0">Total Buy Volume</TextBlock>
<TextBox x:Name="txtTotalBuyVolume" Grid.Column="3" Grid.Row="0" IsEnabled="False"></TextBox>
<!--Row 2-->
<TextBlock Grid.Column="0" Grid.Row="1">Total Sell Amount (ZAR)</TextBlock>
<TextBox x:Name="txtTotalSellAmount" Grid.Column="1" Grid.Row="1" IsEnabled="False"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="1">Total Buy Amount (ZAR)</TextBlock>
<TextBox x:Name="txtTotalBuyAmount" Grid.Column="3" Grid.Row="1" IsEnabled="False"></TextBox>
<!--Row 3-->
<TextBlock Grid.Column="0" Grid.Row="2">Average Sell Price (ZAR)</TextBlock>
<TextBox x:Name="txtAverageSellPrice" Grid.Column="1" Grid.Row="2" IsEnabled="False"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="2">Average Buy Price (ZAR)</TextBlock>
<TextBox x:Name="txtAverageBuyPrice" Grid.Column="3" Grid.Row="2" IsEnabled="False"></TextBox>
<!--Row 4-->
<TextBlock Grid.Column="0" Grid.Row="3">Number of Unfilled Orders</TextBlock>
<TextBox x:Name="txtNumberOfUnfilledOrders" Grid.Column="1" Grid.Row="3" IsEnabled="False"></TextBox>
<TextBlock Grid.Column="2" Grid.Row="3">Slippage (ZAR)</TextBlock>
<TextBox x:Name="txtSlippage" Grid.Column="3" Grid.Row="3" IsEnabled="False"></TextBox>
</Grid>
</GroupBox>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<ListView x:Name="lvSellTrades" Grid.Column="0" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Date, StringFormat=hh:mm:ss tt}" Header="Date"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=AccountCode}" Header="Account Code"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Price, StringFormat={}{0:N0}}" Header="Sell Price"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Volume, StringFormat={}{0:N0}}" Header="Sell Volume"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Amount, StringFormat=R {0:N2}}" Header="Amount"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<ListView x:Name="lvBuyTrades" Grid.Column="1" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Date, StringFormat=hh:mm:ss tt}" Header="Date"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=AccountCode}" Header="Account Code"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Price, StringFormat={}{0:N0}}" Header="Buy Price"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Volume, StringFormat={}{0:N0}}" Header="Buy Volume"></GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Path=Amount, StringFormat=R {0:N2}}" Header="Amount"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Grid>
Any help would be much appreciated.