1
votes

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

1
you dont want Scrollviewer inside Grid? - Frenchy
According to stackoverflow.com/questions/22756920/… this the correct way to do it. - Hilal Najem
is it usercontrol or window? - Frenchy
@Frenchy it is usercontrol - Hilal Najem
I followed you I am @TravisN1213 - Hilal Najem

1 Answers

0
votes

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