Back in June 2009 rameshnkl posted a question "Is there any possible to move the scrollbar to Left side? (content should be normal)."
Various thigs were suggested, culminating in a reference to this link: http://msdn.microsoft.com/en-us/library/cc278065(VS.95).aspx
After this the discussion stopped.
I have tried the approach shown in the link and its does not work. (The XamDataGrid gets scrollbars but they don't work and the grid no longer loads all the data (or if it does, it doesn't display it).
Is there a way of moving the scrollbar to the left and having it work properly? Any chance of an example?
Hello Nigel,
I have been looking into this issue and even thought I didn’t find the discussion you referred to I managed to use the suggestion. I cannot say what is the approach you have tried based on this link, but I altered what appears to be the original template of the ScrollViewer like so:
<Style TargetType="ScrollViewer" >
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="VerticalScrollBarVisibility" Value="Visible" />
<Setter Property="Padding" Value="4"/>
<Setter Property="BorderThickness" Value="1"/>
<!--<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>-->
<Setter Property="Template">
<ControlTemplate TargetType="ScrollViewer">
<Border CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ScrollContentPresenter x:Name="ScrollContentPresenter" Grid.Column="1"
Cursor="{TemplateBinding Cursor}"
Margin="{TemplateBinding Padding}"
ContentTemplate="{TemplateBinding ContentTemplate}"/>
<Rectangle Grid.Column="0" Grid.Row="1" Fill="#FFE9EEF4"/>
<ScrollBar x:Name="VerticalScrollBar" Width="18"
IsTabStop="False"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Grid.Column="0" Grid.Row="0" Orientation="Vertical"
ViewportSize="{TemplateBinding ViewportHeight}"
Maximum="{TemplateBinding ScrollableHeight}"
Minimum="0"
Value="{TemplateBinding VerticalOffset}"
Margin="0,-1,-1,-1"/>
<ScrollBar x:Name="HorizontalScrollBar" Height="18"
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
Grid.Column="1" Grid.Row="1" Orientation="Horizontal"
ViewportSize="{TemplateBinding ViewportWidth}"
Maximum="{TemplateBinding ScrollableWidth}"
Value="{TemplateBinding HorizontalOffset}"
Margin="-1,0,-1,-1"/>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
All I did was move the ContentPresenter, Rectangle and two ScrollBars inside the container Grid (setting their Grid.Row and Grid.Column properties) and switch the Grid’s ColumnDefinitions Widths. Everything seems to work ok and I cannot think of a way for this to prevent the XamDataGrid from loading its data since the grid is simply set as the ContentPresenter.
Please test this out by placing it in the XamDataGrid’s Reseources and let me know if there is something bothering you or if I can assist you any further on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Thanks for the reply Petar.
I'm still having a problem. The scrollbars appear and the vertical scrollbar is on the left, but neither scrollbar acttually scrolls the content area.
I have attached an example program (a VS2008 solution). It generates random data to display in the grid. BTW. We are using v9.2 of Infragistics for WPF.
Could you confirm that you see the symptom?
I am really glad to hear you solved this. Please verify the thread as answered so it helps other users that need this as weel.
Thanks in advance.
I appear to have figured this out. The major problem with the previous suggestions was that you have to set CanContentScroll="True" on the ScrollContentPresenter.
There were a couple of of other minor issues. Here's the final result, which I am now using succesfully in our app:
<Window.Resources>
<ControlTemplate TargetType="ScrollViewer" x:Key="LeftVerticalScrollbar">
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
Grid.Column="1"
Margin="{TemplateBinding Margin}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CanContentScroll="True"
/>
<ScrollBar x:Name="PART_VerticalScrollBar"
Width="{TemplateBinding Width}"
Grid.Column="0" Grid.Row="0"
Orientation="Vertical"
Margin="0"/>
<ScrollBar x:Name="PART_HorizontalScrollBar"
Height="{TemplateBinding Height}"
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=LRCheckBox}"
Value="True">
<Setter Property="Template"
Value="{StaticResource LeftVerticalScrollbar}" />
</DataTrigger>
</Style.Triggers>
</Window.Resources>
<Grid>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<CheckBox x:Name="LRCheckBox" Margin="5">ScrollBar on Left</CheckBox>
<igDP:XamDataGrid Name="xamDataGrid1" Grid.Row="1"
DataSource="{Binding MyDataRecords}" Grid.RowSpan="2">
<igDP:XamDataGrid.Resources>
</igDP:XamDataGrid.Resources>
</igDP:XamDataGrid>
I attach a VS2010 solution that demonstrates how this works.
Hi Nigel,
I have logged this issue with development (ID: 66711) and have created a support ticket on your behalf (CAS-59702-CD963K) to which I have linked the development issue. This is so you are automatically updated when a fix is available for you to download from our website: https://es.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads .
I have been looking through your sample and I was able to replicate the behavior you described. I didn’t manage to find a way to overcome this using the built-in functionality so I am going to consult with our development team to see if they can suggest a suitable approach.
I’ll get back to you shortly.
Petar,
I'd appreciate an update on this when you have a moment.
Are you guys looking at it, or should we abandon the idea of moving the scrollbar to the LHS?
Thanks!
-Nigel.