Telerik Forums
UI for WPF Forum
7 answers
142 views
How do I select a new row, column[0] when I add it to my grid in code?

 

private void Button_Add_Items_Click(object sender, RoutedEventArgs e)

 

{

 

    Item item = new Item();

 

    i.ItemList.Add(item);

    rgvItems.SelectedItem = rgvItems.Items[rgvItems.Items.Count -1];

    rgvItems.ScrollIntoView(rgvItems.SelectedItem);

 


    //rgvItems.BeginEdit();

 

}



The BeginEdit takes me to the first row and column.

Thanks!
Milan
Telerik team
 answered on 08 Jan 2010
3 answers
267 views
Hello!

I use a Chart of many different line series and I want to take advantage of multiple Y Axis in my chart but it's kind of confusing at some point because you could not tell which axes is related to which line series. It would be very helpful if I could somehow bind the color of the line series with the color of the Y axis label or line label, but it seams that I cannot find a way.
Right now I am trying to create a style for  the AxisTitle that uses the same SolidColorBrush that the line series has (guess what - this is null when I'm trying to get it).


Style axisTitleStyleItem = new Style( typeof( AxisTitle ) );
axisTitleStyleItem.Setters.Add( 
new Setter
  { Property = Control.ForegroundProperty,
    Value = (SolidColorBrush)secondaryLineSeries.Appearance.Stroke } ); 

Maybe I'm not taking the right approach. Help would be welcomed at this point.
Thank you!
Roxana
Dwight
Telerik team
 answered on 08 Jan 2010
1 answer
63 views
We are using version 2009.1.526.35 of the GridView control. In some situations, we are encountering NullReferenceExceptions when the GridView attempts to layout with no items in it. We have found this problem happening under at least 2 scenarios:

1) Calling ApplyTemplate() on the GridView and all of its template children recursively.

2) Clearing/Removing all items from the GridView (in this case it seems to happen randomly - definitely not always).

In both cases, the problem is in the Measure pass and appears to be a problem with the GridView's panel. Looks like it is trying to access an item or the first item in the Grid when it is empty.

1) Is this a known issue?
2) Is it fixed in a newer version of the control?

Stack Trace:

   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgumentargument, ExceptionResource resource)

   at System.ThrowHelper.ThrowArgumentOutOfRangeException()

   at System.Collections.Generic.List`1.get_Item(Int32 index)

   atTelerik.Windows.Controls.GridView.GridViewVirtualizingPanel.GetChildIndexByPhysicalOffset(Doubleoffset)

   atTelerik.Windows.Controls.GridView.GridViewVirtualizingPanel.UpdateFirstVisibleChildIndex(Doubleoffset)

   atTelerik.Windows.Controls.GridView.GridViewVirtualizingPanel.SetVerticalOffset(Doubleoffset)

   atTelerik.Windows.Controls.GridView.GridViewVirtualizingPanel.ResetVerticalOffset()

   atTelerik.Windows.Controls.GridView.BaseVirtualizingPanel.MeasureOverride(SizeavailableSize)

   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)

   at System.Windows.UIElement.Measure(Size availableSize)

   at System.Windows.ContextLayoutManager.UpdateLayout()

   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Objectarg)

   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()

   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()

   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(ObjectresizedCompositionTarget)

   at System.Windows.Media.MediaContext.RenderMessageHandler(ObjectresizedCompositionTarget)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegatecallback, Object args, Boolean isSingleParameter)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback, Object args, Boolean isSingleParameter, DelegatecatchHandler)

Vlad
Telerik team
 answered on 08 Jan 2010
2 answers
188 views
Hi Telerik Team,

I'm facing few issues in the Hierarchy  Grid View.

1. When I expand a particular node and scroll down to the end and collapse it back, I see custom formatting applied in the row loaded event of the cells (Text Alignment in particular) gets reset to the default alignment (i.e left), as seen in image1.png.
This doesnt happen when its with in the screen view and it happens only when i scroll, the values in the cells gets scattered and the screen looks awkward.

2. Another connected issue i found during scroll and collapse was the alternate row style applied in design time got applied for all consecutive rows. (image2,png)

3.When I expand a node close to the middle/bottom of the screen and view the data and collapse it back, there is an empty space (apprx 2 rows size)  appearing above that particular node..((Image3.png)
The same thing doenst happen when i scroll up with or with out collapsing the node.
Seems the row content is not redrawn properly.

Expecting a quicker reply.

thanks and regards...
NK

yenkay
Top achievements
Rank 2
 answered on 08 Jan 2010
1 answer
75 views
Hello,
    I am trying to open a dialog radwindow but nothing appears. The window should appear after the user clicks on a button in the primary window. My application is an XBAP. 
Any help would be appreciated.
Thanks
Jorge Gonzalez
Top achievements
Rank 1
 answered on 07 Jan 2010
3 answers
100 views
Hello

I want to let the user find a row by the value of a specific column
this is the scenario-
the user write a text in a TextBox
and click search
then I take the text and find the row
(((System.Data.DataView)RadGridView1.ItemsSource).Table.Select("ActivityName like '%" + txtSearch.Text + "%' ")[0]) 
now I want to select this row
how can I do it?
Milan
Telerik team
 answered on 07 Jan 2010
1 answer
140 views
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> 
 
Stefan Dobrev
Telerik team
 answered on 07 Jan 2010
6 answers
267 views

Hello,

I have a Filter Row in my GridView's header. The normal behaviour of filter is to hide the unmatching rows.
But my requirement is to highlight the matching rows and unmatched rows will still be shown. I am using the following function to do that. I am trying to set the IsSelected Property of the matching records to true, which i hoped will highlight the row. But it is not doing that. Please help.

 public void ApplySelect(object sender)  
        {  
            try  
            {  
                var senderElement = sender as FrameworkElement;  
                FilterRowDescriptor newDescriptor = new FilterRowDescriptor();  
                newDescriptor.LogicalOperator = FilterCompositionLogicalOperator.And;                  
                int idx=0;  
                foreach (MainPage.BuyHeadView bhRow in this.grid.Items)  
                {  
                    TextBox txt = senderElement as TextBox;  
                    if (bhRow.CampaignName.StartsWith(txt.Text.Trim()))  
                    {  
                        this.grid.Records[idx].IsSelected = true;  
                    }  
                    idx++;                      
                }  
                  
                //headerRow.ParentGrid.FilterDescriptors.Remove(headerRow.ParentGrid.FilterDescriptors.Where(fd => fd is FilterRowDescriptor).FirstOrDefault());  
                //headerRow.ParentGrid.FilterDescriptors.Add(newDescriptor);  
            }  
            catch  
            {  
            }  
        } 
Vishnu Ram Kumar
Top achievements
Rank 1
 answered on 07 Jan 2010
1 answer
65 views
Hello
I want to split the Colums in the gridview to 2 parts, that one is fixed and the other is horizenltal scroled

how can i control those attribute  by code in xaml or c#


1 color
2 Start position
Milan
Telerik team
 answered on 07 Jan 2010
3 answers
328 views
Hi,
I'm trying to create a new ControlTemplate for styling the GroupFooterRow.
I've used Reflector to extract the ControlTemplate GridViewGroupFooterRow from the Office Black Theme.
Whilst it looks okay initially, it seems to break down when a user updates a value, or sort a column, and the entire row dissapears underneath the GridViewGroupRow.  (Both intial look and the corrupted look are in the attached images).

Several conditions have to be met for this issue to appear.
A column has be grouped (can't see the footer otherwise).
And all Coumns have to be narrower than the view point.  (ie, no horizontal scroll bar should be visible).

Obviously something is not working right, and I've known that reflector doesn't always get all the template setters.  I was wondering if I could get the original source ControlTemplates for both the GridViewGroupRow and the GridViewGroupFooterRow?

Regards.
Kalin Milanov
Telerik team
 answered on 07 Jan 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?