Telerik Forums
UI for WPF Forum
3 answers
449 views
Hello,

I am using WPF RadGridView in a common user control, and this control supports many different types of data.  The grid is therefore built dynamically in code, and there is no XAML except to define the grid itself.  The data is bound using the ItemsSource property to a QueryableCollectionView.  Our client has requested that we provide a search on the visible grid elements (i.e. current page only), and they do NOT want to filter based on the search, only highlight the cells where the text was found.

I have implemented the code necessary to perform the search.  However, at the point where I find a match, I need to highlight the cell containing the match.  I know the row and column at this point, but I am unclear how to go about changing the cell style with only this information.  Do you have any suggestions?

Here is the event code to perform the search after the search text box (txtSearch) is filled:
 
private void SearchTextBox_Search(object sender, RoutedEventArgs e)
{
    int foundCellCount = 0;
    foreach (object o in ((QueryableCollectionView)theGrid.ItemsSource))
    {
        if (o != null)
        {
            Type rowType = o.GetType();
            PropertyInfo[] props = rowType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
 
            foreach (PropertyInfo pi in props)
            {
                if (IsVisibleColumn(pi.Name))
                {
                    object oCellVal = pi.GetValue(o, null);
                    if ((oCellVal != null) &&
                        ((oCellVal.GetType() == typeof(int)) ||
                         (oCellVal.GetType() == typeof(string)) ||
                         (oCellVal.GetType() == typeof(long))))
                    {
                        string cellVal = oCellVal.ToString();
                        if (cellVal.Contains(txtSearch.Text))
                        {
                            // Match found
                            foundCellCount++;
 
                            // NEED TO HIGHLIGHT THE CONTAINING CELL HERE!!!
                        }
                    }
                }
            }
        }
    }
 
    if (foundCellCount > 0)
    {
        MessageBox.Show(string.Format("Match found in {0} cells", foundCellCount));
    }
    else
    {
        MessageBox.Show("Not Found!");
    }
}
Milan
Telerik team
 answered on 08 Jul 2011
0 answers
101 views

 We are using RadControls for WPF Q2 2010.

In our project we need to update the RadGridView which contains about 100 or more strokes several times in minute. We set the property “DataLoadMode” of the RadGridView to Asynchronous but updating of the GridView hinder the program to work fast and correctly.

Can you tell us the way to resolve this problem?

Alexandra
Top achievements
Rank 1
 asked on 08 Jul 2011
1 answer
100 views
Hello,
I creted custom template for input control. But it doesn't work properly
<Style TargetType="telerik:RadMaskedNumericInput">
       <Setter Property="Margin" Value="2 2 2 2"/>
       <Setter Property="IsClearButtonVisible" Value="False"/>
       <Setter Property="TextMode" Value="PlainText"/>
       <Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
       <Setter Property="Validation.ErrorTemplate">
           <Setter.Value>
               <ControlTemplate>
               </ControlTemplate>
           </Setter.Value>
       </Setter>
       <Style.Triggers>
           <Trigger Property="Validation.HasError" Value="true">
               <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
               <Setter Property="BorderBrush" Value="Red"/>
           </Trigger>
       </Style.Triggers>
   </Style>

First of all ClearButton is still visible.

BorderBrush changed to red after validation error, but only after I focus and unfocus control.
ValidationError don't appear in ToolTip.
I use newest compilation.
Tina Stancheva
Telerik team
 answered on 07 Jul 2011
4 answers
156 views

I am binding a grid to a collection within an object and now get the following stack trace immediately I press Insert or click the 'click to add new row' area of the grid. I am using V 2010.1. Before I start debugging in earnest, please let me know what you think of this trace, which includes a reference to "c:\Builds\WPF_Scrum\..." which is odd, there being no such folder on my PC.
The application uses NHibernate and of course I would not expect you to advise on its behaviour. But, any pointers would be gratefully received!

James.
[stack trace start]
System.NotImplementedException was unhandled by user code
  Message="This is a DynamicProxy2 error: the interceptor attempted to 'Proceed' for a method without a target,
for example, an interface method or an abstract method"
  Source="DynamicProxyGenAssembly2"
  StackTrace:
       at IncidentParameterProxyfd420842db7242d3b17261419bc48c98.Invocationadd_PropertyChanged_1.InvokeMethodOnTarget()
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at Castle.Core.Interceptor.StandardInterceptor.Intercept(IInvocation invocation)
       at Castle.DynamicProxy.AbstractInvocation.Proceed()
       at IncidentParameterProxyfd420842db7242d3b17261419bc48c98.add_PropertyChanged(PropertyChangedEventHandler value)
       at System.ComponentModel.PropertyChangedEventManager.StartListening(Object source)
       at System.ComponentModel.PropertyChangedEventManager.PrivateAddListener(INotifyPropertyChanged source, IWeakEventListener listener, String propertyName)
       at System.ComponentModel.PropertyChangedEventManager.AddListener(INotifyPropertyChanged source, IWeakEventListener listener, String propertyName)
       at MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32 k, Object newO, Object parent)
       at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
       at MS.Internal.Data.PropertyPathWorker.AttachToRootItem(Object rootItem)
       at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
       at System.Windows.Data.BindingExpression.Activate(Object item)
       at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
       at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
       at System.Windows.Data.BindingExpressionBase.Attach(DependencyObject target, DependencyProperty dp)
       at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
       at Telerik.Windows.Controls.GridViewBoundColumnBase.SetBindingIfNeeded(DependencyObject target, DependencyProperty property) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Columns\GridViewBoundColumnBase.cs:line 230
       at Telerik.Windows.Controls.GridView.GridViewCell.UpdateValue() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 1044
       at Telerik.Windows.Controls.GridView.GridViewCell.OnColumnChanged(GridViewColumn oldColumn, GridViewColumn newColumn) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 1035
       at Telerik.Windows.Controls.GridView.GridViewCellBase.set_Column(GridViewColumn value) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCellBase.cs:line 236
       at Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 258
       at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
       at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 866
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 785
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 768
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 680
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChildren(IItemContainerGenerator generator, Int32 startIndex, Int32 endIndex, Size constraint) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 720
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateAndMeasureChildrenForRealizedColumns(Size constraint) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 209
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 86
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
  InnerException: 
[stack trace end]
Jason
Top achievements
Rank 1
 answered on 07 Jul 2011
1 answer
250 views
Hello All,

I have to perform a few hacks and implement a custom AccessKey registration (like seen here), to ensure that the IsDefault and IsCancel buttons embeded in a RadWindow work properly, but it is taking its toll and created a very convoluted development experience.  It would be helpful if Telerik provided some wisdome on how to customize the RadWindow so it handles AccessKey scops on it's own.  Perhaps there is some feature already included that I'm not aware of?

- Rashad Rivera
  www.omegusprime.com
Miroslav Nedyalkov
Telerik team
 answered on 07 Jul 2011
1 answer
143 views
Is extending the RadRichTextBox object model a scenario that is technically possible? What I am talking about is creating new inline objects in order to enable embedding other content but images. For example I would like to add the ability to introduce a video and audio element based on the MediaPlayer control etc.
.
Iva Toteva
Telerik team
 answered on 07 Jul 2011
0 answers
57 views
Hello all,
I have a problem using RadGridView as i want a very customized behavior.
Here is the structure i have. I have a RadGridView that is bound to an ObservableCollection.This collection holds objects that implement INotifyPropertyChanged in order for the UI to be notified whenever a property value changes in any object.
What i want to do is whenever any property value changes i would do some checking and accordingly change the RadGridView cell background color for a couple of seconds then set it back again to it's original color (flashing effect).
The main problem is that I cannot access the RadGridView cells from the code behind.
I tried some trials but i had a problem in each of them..

I made my own style selector where i made my checking a return the desired style, and assigned this style selector column CellStyleSelector property (Xaml). But then, i am able to change the cell background color but cannot set it back to it's original.

I placed my whole logic in a ListBox and then place it inside the RadGridView as a DataTemplate in GridViewColumn. But again i'm not able to access the list box from the code behind.

I feel like I'm close to the solution but there must be something missing.
Could you help me in that??

Thank you very much for your help in advance.
Ola
Top achievements
Rank 1
 asked on 07 Jul 2011
0 answers
123 views
Hello Telerik team,

Could you please let me know how can we instantiate the row indicator column of WPF telerik radgrid.
I need to add a context menu to the row indicator column.


Thanks,
Regards,
Mausami
Mausami
Top achievements
Rank 1
 asked on 07 Jul 2011
1 answer
197 views
Hi,
I am usinf RadExpander control to expand and collapse the panel. i have added this expander control in canvas with height and width set to Auto. but on expand and collapse the height of that convas is not getting changed.

Could you please help me

Thanks,
Nikhil 
Petar Mladenov
Telerik team
 answered on 07 Jul 2011
1 answer
174 views
I want to turn off opacity animation when I set IsBusy =  true;
How to achieve this?
The problem is that I don't use  separate thread with my busyIndicator, and I don't want to use another threads.
When I put:
IsBusy =  true;
//long process here
IsBusy =  false;

The busy indicator don't appear. I think it may be caused by opacity animation.


Konstantina
Telerik team
 answered on 07 Jul 2011
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
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
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?