Hilal Najem
Hilal Najem

Reputation: 177

ScrollViewer in WPF-Caliburn micro

I can't make the ScrollViewer in WPF while using Caliburn Micro MVVM work! https://github.com/moon1234moon/Factures

Here is my XML code:

<ScrollViewer VerticalScrollBarVisibility="Visible"
                  HorizontalScrollBarVisibility="Visible">
        <Grid HorizontalAlignment="Left" VerticalAlignment="Top"
              MaxHeight="900"
              MaxWidth="900"
              >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="20" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="20" />
            </Grid.RowDefinitions>

            <!-- Deleted because they are quite a lot -->

            <ContentControl Grid.Column="3" Grid.Row="1" Grid.RowSpan="5" 
                        x:Name="ActiveItem"
                        Margin="30, 150, 30, 30"
                        />
        </Grid>
    </ScrollViewer>

Of-course I tried making the scroll enabled IsEnabled = true and added VerticalAlignment and HorizentalAlignment to it but non of that seemed to work!..

Please Help!! PS: The most important part is for me to be able to scroll horizontally to see the content of the ContentControl

And here is the result: Image shows scroll to be not enabled

Upvotes: 1

Views: 230

Answers (1)

Frenchy
Frenchy

Reputation: 17007

1) put off the command MaxHeight and MaxWidth from your view which is usercontrol

2) put off the scrollviewer of the same view and define scrollviewer in the main window (shellview i suppose). The main window contents all usercontrols

3)all will be ok

Upvotes: 0

Related Questions