Quantcast
Channel: Silverlight 5 forum
Viewing all articles
Browse latest Browse all 1083

Removing scrollviewer from Pivotviewer

$
0
0

Don't know why, but moving my pivotviewer application from Silverlight 4 to Silverlight 5 changed some things.

When I used to switch to graphview my categories used to group together into some ranges like in this figure (in SL4)

enter image description here

Now something changed and each category has its own column in graphview.

enter image description here

I would like to go back to the old behaviour, but I don't know how to disable it. Moreover a scrollviewer is on the bottom of the pivotviewer.

Tried to play with ScrollViewer like this.

<pivot:PivotViewer x:Name="PivotMainPage" ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Hidden" />

It seems like it doesn't want to work. Any suggestion?

I suspect that it has something to do with the width and height of containers. It seems like the minimum MinHeight = 250 e MinWidth = 450 affect the pivotviewer to exceed the border of the column.

I cut out all the useless things and just discovered that Pivotviewer arbitrarily decides when to use the scrollviewer. I can find a way to disable it. Now the behaviour is a mix between the old SL4 (some items are grouped) and the new SL5 (even if items are grouped the scrollbar is available).

Here is an example of the first picture in SL5!

enter image description here

This is the new code:

<UserControl x:Class="PVClean.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:pivot="clr-namespace:System.Windows.Controls.Pivot;assembly=System.Windows.Controls.Pivot"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"><Grid x:Name="LayoutRoot" Background="White"><pivot:PivotViewer x:Name="PivotMainPage" ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Hidden"  /></Grid></UserControl>

This is the code behind:

public MainPage()
        {
            InitializeComponent();
            PivotMainPage.Loaded += pViewer_Loaded;
        }



        void pViewer_Loaded(object sender, RoutedEventArgs e)
        {
            _cxml = new CxmlCollectionSource(new Uri("http://pivot.blob.core.windows.net/msdn-magazine/msdnmagazine.cxml", UriKind.Absolute));
            _cxml.StateChanged += _cxml_StateChanged;
        }

        void _cxml_StateChanged(object sender,
                               CxmlCollectionStateChangedEventArgs e)
        {
            if (e.NewState == CxmlCollectionState.Loaded)
            {
                PivotMainPage.PivotProperties =
                           _cxml.ItemProperties.ToList();
                PivotMainPage.ItemTemplates =
                           _cxml.ItemTemplates;
                PivotMainPage.ItemsSource =
                           _cxml.Items;
            }
        }


Viewing all articles
Browse latest Browse all 1083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>