Telerik Forums
UI for WPF Forum
3 answers
87 views

We are seeing a problem occasionally where, when switching the data displayed in the grid, some of the prior rows continue to display (see attached). These rows seem to just hang there since their location is not necessarily immediately following a valid row. Which is one way we know these are not actual rows that are part of our dataset. 

One way to make this happen is to go into insert mode on a cell and then click elsewhere (in our case it is in a tree control) to make the grid reload with new data that has fewer rows than it originally had. The hard part of this is that I have not been able to reproduce this in a sample application. Our actual application's use of the grid is quite rich with features (virtualization, attached properties, non-auto generated columns, asynch dataloading) so it is not easy to bring all this over to a sample. I do have my sample using the above except for the attached properties.

Has anyone seen anything like this? Any clues as to how to prevent? It doesn't just happen if you are in insert mode but that is a sure-fire way to make it happen. I've tried having the code call CancelEdit on the grid before it switches the data but that did not help.

I've attached 2 screen shots. One shows the phantom rows without having been in insert mode prior to capturing this screen. The other shows the case when the user was in insert mode. You can see the phantom row showing the insert indicator on the left. I've drawn a red box around these phantom rows in these screen shots.

Thank you, Valerie
Dimitrina
Telerik team
 answered on 03 Jul 2013
3 answers
108 views
Hi All
I have a grid with custom columns which are resizable. Whenever I resize a column or add a new column the headers and the rows are misaligned as in the attached image. But when I scroll everything is reset back and everything looks good.Did anyone face this issue. Any help is much appreciated.

     
Maya
Telerik team
 answered on 03 Jul 2013
14 answers
547 views
Hi,

in my RadGridView I have multiple columns and for all columns the IsFilterable property is set to true. Actually, for all columns who have a DataMemberBinding, the filtering icon are missing.

Thank's
Rossen Hristov
Telerik team
 answered on 03 Jul 2013
1 answer
203 views
I am using two RadListBoxes as well as a ItemCollection.  The are bound to observable collections of business objects.    When I drag items between them, I don't want the item to be removed from the collection, but rather just a copy placed where it was dragged to.  How would I keep the items in the list?   It seems no matter what I do, the item is removed from the list that it was drug from.
heavywoody
Top achievements
Rank 1
 answered on 03 Jul 2013
2 answers
163 views
I need to set a Cell in a Column to ReadOnly based on another value. How can I do this on a row by row basis?
Thanks in  advance,
Steve
public class RowData
{
    public String Description { get; set; }
    public bool CanEdit { get; set; }
}
Steve
Top achievements
Rank 1
 answered on 02 Jul 2013
2 answers
57 views
Hi all,
Should be Zoom-in/out slot's height,not width.



Wenjie
Top achievements
Rank 1
 answered on 02 Jul 2013
5 answers
117 views
I have a RadGridView setup as follows:

                            <tk:RadGridView Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Height="175" Margin="0,5,0,10" Width="960" 
                                            AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" 
                                            CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSelect="True" CanUserSortColumns="False" 
                                            HorizontalAlignment="Left" IsFilteringAllowed="False" ItemsSource="{Binding EquipmentToAdd}" MinHeight="150" 
                                            RowIndicatorVisibility="Collapsed" SelectionUnit="Cell" ShowGroupPanel="False" VerticalAlignment="Bottom" ActionOnLostFocus="CommitEdit">
                                <i:Interaction.Behaviors>
                                    <cv:CellValidationBehavior />
                                    <cf:EquipmentQuickEntryGrid/>
                                </i:Interaction.Behaviors>

                                <tk:RadGridView.Columns>
                                    <tk:GridViewDataColumn Width="50" DataMemberBinding="{Binding Path=Count}" Header="Count" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="110" DataMemberBinding="{Binding Path=BaseEquipmentType}" Header="Base Type" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=EquipmentType}" Header="Equipment Type" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="130" DataMemberBinding="{Binding Path=Manufacturer}" Header="Manufacturer" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=Model}" Header="Model" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" DataMemberBinding="{Binding Path=AssetNumber}" Header="Asset Number" IsReadOnly="True" />
                                    <tk:GridViewDataColumn Width="150" Header="Serial Number" CellTemplateSelector="{StaticResource isAssetInUseSerialNumberTemplateSelector}" UniqueName="SerialNumber" IsReadOnlyBinding="{Binding IsInUse}"/>
                                    <tk:GridViewDataColumn Width="55"  Header="Remove" CellTemplateSelector="{StaticResource isAssetInUseDeleteTemplateSelector}" IsReadOnlyBinding="{Binding IsInUse}" />
                                    <tk:GridViewDataColumn Width="50" DataMemberBinding="{Binding Path=IsInUse}" IsVisible="False" />
                                </tk:RadGridView.Columns>
                                <tk:RadGridView.GridViewGroupPanel>
                                    <tk:GridViewGroupPanel AllowDrop="False" IsEnabled="False" Visibility="Hidden" />
                                </tk:RadGridView.GridViewGroupPanel>
                            </tk:RadGridView>

The CellValidationBehavior logic executes on Attach and Detach:
    using Telerik.Windows.Controls;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class CellValidationBehavior : Behavior<RadGridView>
    {
        private EquipmentQuickEntryViewModel _viewModel = null;

        /// <summary>
        /// Overrides the OnAttached event so we can hook up the RowLoaded event
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();

            this.AssociatedObject.DataLoaded += new EventHandler<EventArgs>(DataLoaded);
            this.AssociatedObject.CellValidating += new EventHandler<GridViewCellValidatingEventArgs>(CellValidating);
            this.AssociatedObject.RowValidated += new EventHandler<GridViewRowValidatedEventArgs>(RowValidated);
        }

        /// <summary>
        /// Overrides the OnDetaching method to add handlers to some DragDrop events
        /// </summary>
        protected override void OnDetaching()
        {
            base.OnDetaching();

            this.AssociatedObject.DataLoaded -= new EventHandler<EventArgs>(DataLoaded);
            this.AssociatedObject.CellValidating -= new EventHandler<GridViewCellValidatingEventArgs>(CellValidating);
            this.AssociatedObject.RowValidated -= new EventHandler<GridViewRowValidatedEventArgs>(RowValidated);
        }

        /// <summary>
        /// Captures the DataLoaded event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The EventArgs</param>
        private void DataLoaded(object sender, EventArgs e)
        {
            var grid = this.AssociatedObject;
            var dataSource = (ObservableCollection<EquipmentToAdd>)grid.ItemsSource;

            if (dataSource.Count>0)
            {
                if (_viewModel == null)
                {
                    _viewModel = grid.DataContext as EquipmentQuickEntryViewModel;
                }

                var selectedRow = _viewModel.SelectedRowNumber;

                grid.ScrollIntoView(grid.Items[selectedRow], grid.Columns["SerialNumber"]);

                grid.CurrentCellInfo = new GridViewCellInfo(grid.Items[selectedRow], grid.Columns["SerialNumber"]);

                var equipment = (EquipmentToAdd)grid.Items[selectedRow];

                if (equipment.IsInUse)
                {
                    return;
                }
                
                grid.BeginEdit();
            }
        }

        /// <summary>
        /// Captures the CellValidating event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The GridViewCellValidatingEventArgs</param>
        private void CellValidating(object sender, GridViewCellValidatingEventArgs e)
            {
            if (e.Cell.Column.UniqueName != "SerialNumber")
            {
                return;
            }

            var value = e.NewValue.ToString();

            if (!string.IsNullOrEmpty(value))
            {
                if (this._viewModel == null)
                {
                    this._viewModel = ((RadGridView)sender).DataContext as EquipmentQuickEntryViewModel;
                }
                EquipmentToAdd thisEquipment = (EquipmentToAdd)e.Row.DataContext;
                var isDuplicate = this._viewModel.IsDuplicateSerialNumber(value, thisEquipment);

                if (isDuplicate)
                {
                    e.IsValid = false;
                    e.ErrorMessage = "That serial number already exists";
                    return;
                }

                _viewModel.UpdateCanSave();
            }
        }

        /// <summary>
        /// Captures the RowValidated event from the grid
        /// </summary>
        /// <param name="sender">The RadGridView we attached to</param>
        /// <param name="e">The GridViewRowValidatedEventArgs</param>
        private void RowValidated(object sender, GridViewRowValidatedEventArgs e)
        {
            if (_viewModel == null)
            {
                _viewModel = ((RadGridView)sender).DataContext as EquipmentQuickEntryViewModel;
            }

            _viewModel.UpdateCanSave();
        }
    }

I confirmed that it is being passed the RadGridView object.  However when I enter data into the cell containing the serial number (only editable field) I do not get any validation events.  

WHY??
Dimitrina
Telerik team
 answered on 02 Jul 2013
1 answer
67 views
I have a case where my filter descriptors on my gridview are being removed / cleared out when the grid view is inside a radpane inside a raddocking control, and when you drag and drop the radpane to another position, or even dragging and popping it out.

I have an example project which demonstrates this behavior.  The gridview's ItemSource is bound to an observable collection of test viewmodel's.  You can see after you drag the radpane in question that all of the rows appear, even the ones that are supposed to be filtered out.  Going even further I have confirmed that the filterdescriptors are being removed by using Snoop.  I examine them before drag, and then again after drag.  After drag they are completely gone.  Let me know if you would like to test my example project.

Please advise on a solution to this issue. 

Thank You.
Yoan
Telerik team
 answered on 02 Jul 2013
1 answer
126 views
Hi!

Is there a way to put texts at certain coordinates in the chart (see attached picture) triggered by a button click event? We are not using point labels or legends here.

Would really appreciate your help.

Thanks!
Petar Kirov
Telerik team
 answered on 02 Jul 2013
2 answers
163 views
Hello,

I have a RadGridView.  It has as its source an ObservableCollection of a custom class.  There are three columns representing the data from this custom class.  What I am trying to do is apply a very specific converter to convert a value to a string.  I want to check the value in the first column and then apply the converter to the second and possibly the third column.
I tried using a DataTrigger.  If I set the target type to telerik:GridViewCell or telerik:GridViewRow, I am able to catch the row I want.  I think I should use the GridViewCell, but since all three columns refer to the same object, I am struggling to know which column the cell is in.  For my initial testing I am simply trying to change the background color of the cell I want, but later I will want to apply the Converter to the cell.

If I apply the converter directly to the column, I only get the value in the column and therefore do not know the corresponding value in the first column of the same row.

I am probably missing something to enable the functionality I want and am hoping someone could point me in the right direction.

Thanks,
Chris
Chris
Top achievements
Rank 1
 answered on 02 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?