This is a migrated thread and some comments may be shown as answers.

Weird scrolling style issue

1 Answer 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 2
Chris asked on 04 Jan 2010, 06:40 AM
This one I have to class as wierd.

Version: WPF Q3 2009 SP1  2009.3.1208.35

I have a GridView with 7 predefined columns.
3 of the columns have HeaderCellStyle defined.  They do not have ControlTemplates.  I've only applied a few property setters to change the visual appearance.

The application starts off with a large size, so there are no scroll bars visible.
First issue is here.  Sizing the application Window down by grabbing the bottom right thumb, the scroll bars do no properly appear.  I ahe to move the mouse about to get the horizontal scroll bar to appear, and it doesn't appear to be based fully on the GridView's visible size.

Second issue.  If you resize the Window, and make it as narrow as possible, and then widen it again, the styling on the last column (Receipt Application) has changed.  This column was defined without a style, and now it's somehow gotten the style from the column next to it.

Thrid issue.  If you are somehow able to size the Window down to half it's initial width, and have a Horizonal Scroll Bar.  Now, click on the Horizontal Scroller, and moved it left and right quickly.  The other two columns that didn't have styling, now magically have the styling applied!



namespace WpfApplication_DataGrid  
{  
    using System;  
    using System.Collections.Generic;  
    using System.Collections.ObjectModel;  
    using System.Windows;  
    using System.Windows.Data;  
    using Telerik.Windows.Controls;  
 
    /// <summary>  
    /// Interaction logic for Window8.xaml  
    /// </summary>  
    public partial class Window8 : Window  
    {  
        public Window8()  
        {  
            InitializeComponent();  
 
 
            Binding binding;  
 
 
            ObservableCollection<Receipt> list2 = new ObservableCollection<Receipt>();  
            list2.Add(new Receipt("HELLO", 1123, 456, 1, 8, DateTime.Today, "B"));  
            list2.Add(new Receipt("HELLO", 2123, 456, 2, 7, DateTime.Today, "B"));  
            list2.Add(new Receipt("HELLO", 3123, 456, 3, 6, DateTime.Today, "C"));  
            list2.Add(new Receipt("HELLO", 4123, 456, 4, 5, DateTime.Today, "C"));  
            list2.Add(new Receipt("WORLD", 1123, 456, 5, 4, DateTime.Today, "A"));  
            list2.Add(new Receipt("WORLD", 2123, 456, 6, 3, DateTime.Today, "B"));  
            list2.Add(new Receipt("WORLD", 3123, 456, 7, 2, null"C"));  
            list2.Add(new Receipt("WORLD", 4123, 456, 8, 1, DateTime.Today, "D"));  
            list2.Add(new Receipt("WORLD", 4123, 456, 8, 1, DateTime.MinValue, "D"));  
 
 
            binding = new Binding();  
            binding.Source = list2;  
            uxRadGridView.SetBinding(RadGridView.ItemsSourceProperty, binding);  
 
        }  
    }  
}  
 
namespace WpfApplication_DataGrid  
{  
    using System;  
    using System.ComponentModel;  
 
    public class Receipt : INotifyPropertyChanged  
    {
        #region fields  
        string _source;  
        double _amount;  
        double _associatedAmount;  
        double _allocatedAmount;  
        double _availableAmount;  
        DateTime? _receiptEffectiveDate;  
        string _receiptApplication;
        #endregion  
 
        #region ctor  
        public Receipt()  
        {  
        }  
 
        public Receipt(string source, double amount, double associatedAmount, double allocatedAmount, double availableAmount, DateTime? receiptEffectiveDate, string receiptApplication)  
        {  
            Source = source;  
            Amount = amount;  
            AssociatedAmount = associatedAmount;  
            AllocatedAmount = allocatedAmount;  
            AvailableAmount = AvailableAmount;  
            ReceiptEffectiveDate = receiptEffectiveDate;  
            ReceiptApplication = receiptApplication;  
        }
        #endregion  
 
        #region properties  
        public string Source  
        {  
            get { return _source; }  
            set 
            {  
                _source = value;  
                NotifyPropertyChanged("Source");  
            }  
        }  
        public double Amount  
        {  
            get { return _amount; }  
            set 
            {  
                _amount = value;  
                NotifyPropertyChanged("Amount");  
            }  
        }  
        public double AssociatedAmount  
        {  
            get { return _associatedAmount; }  
            set 
            {  
                _associatedAmount = value;  
                NotifyPropertyChanged("AssociatedAmount");  
            }  
        }  
        public double AllocatedAmount  
        {  
            get { return _allocatedAmount; }  
            set 
            {  
                _allocatedAmount = value;  
                NotifyPropertyChanged("AllocatedAmount");  
            }  
        }  
        public double AvailableAmount  
        {  
            get { return _availableAmount; }  
            set 
            {  
                _availableAmount = value;  
                NotifyPropertyChanged("AvailableAmount");  
            }  
        }  
        public DateTime? ReceiptEffectiveDate  
        {  
            get { return _receiptEffectiveDate; }  
            set 
            {  
                _receiptEffectiveDate = value;  
                NotifyPropertyChanged("ReceiptEffectiveDate");  
            }  
        }  
 
        public string ReceiptApplication  
        {  
            get { return _receiptApplication; }  
            set 
            {  
                _receiptApplication = value;  
                NotifyPropertyChanged("ReceiptApplication");  
            }  
        }
        #endregion  
 
        #region Interface INotifyPropertyChanged  
        public event PropertyChangedEventHandler PropertyChanged;  
 
        private void NotifyPropertyChanged(string propertyName)  
        {  
            if (PropertyChanged != null)  
                PropertyChanged(thisnew PropertyChangedEventArgs(propertyName));  
        }
        #endregion  
    }  
}  
 
<Window x:Class="WpfApplication_DataGrid.Window8" Title="Window8" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:WpfApplication_DataGrid" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Height="700" Width="900" WindowStartupLocation="CenterScreen">  
    <Window.Resources> 
        <LinearGradientBrush x:Key="ColumnHeaderBackgroundBrush" EndPoint="0.494,0.889" StartPoint="0.494,0.028">  
            <GradientStop Color="#FFE7F1FF" Offset="0"/>  
            <GradientStop Color="#FFD2E6FF" Offset="0.4"/>  
            <GradientStop Color="#FFC7DFFF" Offset="0.4"/>  
            <GradientStop Color="#FFC7DFFF" Offset="1"/>  
        </LinearGradientBrush> 
        <SolidColorBrush x:Key="CellSeperatorBorderBrush" Color="#FFB3B3B3"/>  
 
 
        <Style x:Key="GridViewHeaderCellStyle" TargetType="{x:Type telerik:GridViewHeaderCell}">  
            <Setter Property="Background" Value="{StaticResource ColumnHeaderBackgroundBrush}" /> 
            <Setter Property="BorderBrush" Value="{StaticResource CellSeperatorBorderBrush}"/>  
            <Setter Property="BorderThickness" Value="0,0,1,0"/>  
            <Setter Property="Foreground" Value="Black"/>  
            <Setter Property="FontWeight" Value="Light"/>  
            <Setter Property="FontSize" Value="12"/>  
            <Setter Property="DropMarkPen">  
                <Setter.Value> 
                    <Pen Thickness="60">  
                        <Pen.Brush> 
                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">  
                                <GradientStop Color="#00F4F5F6" Offset="0"/>  
                                <GradientStop Color="#B2808080" Offset="0.5"/>  
                                <GradientStop Color="#00F4F5F6" Offset="1"/>  
                            </LinearGradientBrush> 
                        </Pen.Brush> 
                    </Pen> 
                </Setter.Value> 
            </Setter> 
            <Setter Property="SnapsToDevicePixels" Value="True"/>  
        </Style> 
    </Window.Resources> 
    <Grid> 
        <telerik:RadGridView xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"   
                    AutoGenerateColumns="False" 
                    x:Name="uxRadGridView" telerik:StyleManager.Theme="Office_Black">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding Source}" /> 
                <telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding Amount}" /> 
                <telerik:GridViewDataColumn IsFilterable="False" Header="Associated Amount" DataMemberBinding="{Binding AssociatedAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/>  
                <telerik:GridViewDataColumn IsFilterable="False" Header="Allocated Amount" DataMemberBinding="{Binding AllocatedAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/>  
                <telerik:GridViewDataColumn IsFilterable="False" Header="Available Amount" DataMemberBinding="{Binding AvailableAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/>  
                <telerik:GridViewDataColumn IsFilterable="False" Header="Receipt Effective Date" DataMemberBinding="{Binding ReceiptEffectiveDate}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/>  
                <telerik:GridViewComboBoxColumn IsFilterable="False" UniqueName="ReceiptApplication" Header="Receipt Application" DataMemberBinding="{Binding ReceiptApplication}" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 07 Jan 2010, 10:39 AM
Hi Chris,

Find my answers in order:
  1. This appears to be a problem with the grid. We are currently investigating this incorrect behavior when ColumnWidth is set to Auto or SizeToHeader.
  2. This problem came out from our horizontal virtualization. The issue has already been fixed in our code base. The fix will be available in the service pack release we are going to publish next week.

Hope this helps,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Chris
Top achievements
Rank 2
Answers by
Stefan Dobrev
Telerik team
Share this question
or