Ranjit Menon

Ranjit Menon

  • NA
  • 8
  • 7.7k

Scroll bar of the textblock not working

Apr 8 2014 12:41 PM
If you notice belowTextblock is wrapped in ScrollViewer control but the scrolling doesnt seem to work. Please see the code below



  <StackPanel Orientation="Vertical" Margin="5,29,5,10" Width="295"  VerticalAlignment="Stretch">
            <Image Name="imgInventory" Stretch="Fill" Height="118" VerticalAlignment="Top" DockPanel.Dock="Right" Margin="10,0"/>
            <ScrollViewer Name="Contentscroll">
                <TextBlock Name="txtDescription" Height="146" TextWrapping="Wrap" Padding="0,2,0,2" Margin="0,0,10,0" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" ></TextBlock>
            </ScrollViewer>
            <Border CornerRadius="6"
                BorderBrush="Gray"
                BorderThickness="2"
                Padding="8" Height="182" Margin="0,0,10,0">

                  <Grid  Height="158"   >
                    <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="86"></ColumnDefinition>
                        <ColumnDefinition Width="86"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions >
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>

                <Label Grid.Row="0" Grid.Column="0">Type:</Label>
                <Label Name="lblType" Grid.Row="0" Grid.Column="1">Type:</Label>

                <Label Grid.Row="1" Grid.Column="0">Make:</Label>
                <Label Name="lblMake" Grid.Row="1" Grid.Column="1"></Label>

                <Label Grid.Row="2" Grid.Column="0">Model:</Label>
                <Label Name="lblModel" Grid.Row="2" Grid.Column="1"></Label>

                <Label Name="lblNoOfWheels" Grid.Row="3" Grid.Column="0">No of Wheels:</Label>
                <Label Name="lblNo_Of_Wheels" Grid.Row="3" Grid.Column="1">Type:</Label>

                <Label Grid.Row="4" Grid.Column="0">Road Vehicle:</Label>
                <Label Name="lblRoadVehicle" Grid.Row="4" Grid.Column="1">Type:</Label>

                <Label Grid.Row="5" Grid.Column="0">Quantity:</Label>
                    <TextBox Name="txtQuantity" Grid.Row="5" Margin="7,0,0,0" Grid.Column="1" HorizontalAlignment="Left" Width="33" />
                <Button Name="btnEdit" Content="Edit" Grid.Column="2" HorizontalAlignment="Left" Margin="14,0,0,3" Grid.Row="5" Width="46" RenderTransformOrigin="-0.027,0.5" Height="20" VerticalAlignment="Bottom" Click="btnEdit_Click"/>
                </Grid>
                </Border>
                
            </StackPanel>

Answers (1)