XAML: Scrulling text



  • Good day.

    I can't figure out how to make that mark:

    There must be table 2x2, in the top line of each button cell, in the bottom of each cell the text is still clear.

    The dimensions of the columns shall be 50 per cent, the ratio shall be maintained at any change in the size of the window.

    The text may be long and not in the window, so he has to bleed, tried the textBlock, how to scrulling, I don't understand.



  • Apparently, you need this:

    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Button Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Width="100">
            привет
        </Button>
        <Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Width="100">
            пока
        </Button>
        <ScrollViewer Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Padding="5"
                      VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto">
            <TextBlock Text="абра-швабра-кадабра!"/>
        </ScrollViewer>
        <ScrollViewer Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Padding="5"
                      VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto">
            <TextBlock Text="երեք ույու չորս"/>
        </ScrollViewer>
    </Grid>
    

    That's what happens:

    пример


    If you have a vertical scrubbing, you're going to have to put the height of the cells. And allow the textblock to break into line:

    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Button Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Width="100">
            Чебурашка
        </Button>
    
    &lt;Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Width="100"&gt;
        Шапокляк
    &lt;/Button&gt;
    &lt;ScrollViewer Grid.Row="1" Grid.Column="0" Padding="5"
                  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden"&gt;
        &lt;TextBlock Text="Бамбара, чуфара, скорики, морики, турабо, фурабо, лорики, ёрики"
                   TextWrapping="Wrap"/&gt;
    &lt;/ScrollViewer&gt;
    &lt;ScrollViewer Grid.Row="1" Grid.Column="1" Padding="5"
                  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden"&gt;
        &lt;TextBlock Text="այբ բեն գիմ"
                   TextWrapping="Wrap"/&gt;
    &lt;/ScrollViewer&gt;
    

    </Grid>

    It happens:

    ещё пример


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2