1

Bars move, but the content does not scroll.

Any ideas?

I want to create a work schedule

<Window x:Class="WpfMiGantt.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon">
    <Grid ShowGridLines="True">
        <ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"  >
            <Border Width="1000" Height="1000"/>
        </ScrollViewer >
        <Grid ShowGridLines="True">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>      
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="1" ShowGridLines="True" >
                <Grid.ColumnDefinitions >
                    <ColumnDefinition Width="60" />
                    <ColumnDefinition Width="60"  />
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                    <ColumnDefinition  Width="60"/>
                </Grid.ColumnDefinitions>
                <my:RibbonTextBox Height="23"  Label="6:00" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox0" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="6:30" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox1" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="7:00" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox2" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="7:30" Grid.Column="3" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox3" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="8:00" Grid.Column="4" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox4" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="8:30" Grid.Column="5" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox5" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="9:00" Grid.Column="6" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox6" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="10:00" Grid.Column="7" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox7" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="10:30" Grid.Column="8" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox8" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="11:00" Grid.Column="9" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox9" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="11:30" Grid.Column="10" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox10" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="12:00" Grid.Column="11" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox11" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="12:30" Grid.Column="12" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox12" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="13:00" Grid.Column="13" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox13" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="13:30" Grid.Column="14" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox14" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="14:00" Grid.Column="15" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox15" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="14:30" Grid.Column="16" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox16" VerticalAlignment="Center" />
                <my:RibbonTextBox Height="23"  Label="15:00" Grid.Column="17" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="ribbonTextBox17" VerticalAlignment="Center" />

            </Grid>
            <my:RibbonButton Label="Fecha" Grid.Column="0" Grid.Row="0"  Content="Button"  Height="30" HorizontalAlignment="Center" Margin="0" Name="ribbonButton0" VerticalAlignment="Center" Width="Auto" />
            <my:RibbonButton Label=""  Grid.Column="0" Grid.Row="1" Content="Button"  Height="30" HorizontalAlignment="Center" Margin="0" Name="ribbonButton1" VerticalAlignment="Top" Width="75" />
            <my:RibbonButton Content="Button" Grid.Column="2" Grid.ColumnSpan="2" Height="23" HorizontalAlignment="Left" Margin="38,8,0,0" Name="ribbonButton2" VerticalAlignment="Top" Width="75" />
        </Grid>
    </Grid>
</Window>

I think the order of the lines is the key.

PD: Have you seen any similar project in codeplex or with WPF? 4

1 Answer 1

3

I suspect you want the scroll bars to act on the Grid. You will have to have the Grid in the ScrollViewer in that case

<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"  >
        <Grid ShowGridLines="True" Width="1000" Height="1000">
            ...rest of grid content
        </Grid>
    </ScrollViewer >
Sign up to request clarification or add additional context in comments.

1 Comment

If this answers your question then can you mark as answered. (The little tick under the vote number)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.