Telerik Forums
UI for WPF Forum
1 answer
80 views
hello,

i am using your grid and i need to set the style of the cells dynamically based on the dataitem i have.
How should i do it?

I thought about inherit from GridViewDataColumn, but didn't know how to do it correctly (i.e. apply the data binding etc)


Thanks,
ofer
Vlad
Telerik team
 answered on 10 Nov 2009
4 answers
171 views
Hi,

It seems I can never get ScrollIntoView work. I got an error when I do:

if (grid.SelectedItem !=null)
    grid.ScrollIntoView(grid.SelectedItem);

Did I miss anything?

Thanks,
Milan
Telerik team
 answered on 10 Nov 2009
1 answer
161 views
i heard that you can do it with ChildTableDefinition

can someone show me how to do it?

i currently have 2 levels (parent->child)
i want to have 3 levels (parent->child->child of child)

how can i do it?

this is the xaml:

<Window x:Class="SimaClient.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    Title="Sima Client" Height="300" Width="400" WindowStyle="ToolWindow">  
    <Grid> 
        <telerik:RadGridView Name="RadGridView1" ShowGroupPanel="False" IsReadOnly="True" AutoGenerateColumns="False" ColumnsWidthMode="Fill">  
 
            <telerik:RadGridView.ChildTableDefinitions> 
                <telerik:GridViewTableDefinition /> 
            </telerik:RadGridView.ChildTableDefinitions> 
 
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID" Width="100" /> 
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"  Width="200"/>  
            </telerik:RadGridView.Columns> 
 
            <telerik:RadGridView.HierarchyChildTemplate> 
                <DataTemplate> 
                    <telerik:RadGridView x:Name="RadGridView1" AutoGenerateColumns="False" ItemsSource="{Binding Routes}" ShowGroupPanel="False" IsReadOnly="True">  
                        <telerik:RadGridView.Columns> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="Route ID" /> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Route Name" /> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding WayPointsNum , Mode=OneWay }" Header="Number of WP" /> 
                        </telerik:RadGridView.Columns> 
                    </telerik:RadGridView> 
                </DataTemplate> 
            </telerik:RadGridView.HierarchyChildTemplate> 
 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 
Vlad
Telerik team
 answered on 10 Nov 2009
1 answer
91 views

i tried using the GridViewColumn.CellTemplate but i can't change it at runtime,

what i want to do is on the RowLoaded event change the cell visual tree(ComboBox, CheckBox)
based on the type of the object in the Cell.Content

i want to be able to change it for each individual cell
not a whole row/Column


i know that somewhere inside the cell there is a:

{System.Windows.Controls.Border}
and inside of it there is

{Telerik.Windows.Controls.GridView.AlignmentContentPresenter}
and inside of it there is the CellTemplate
but i can't access it from c#

 

i also tried to put in the resources of the GridView, couple of DataTemplates for different types (int,brush,enum)
but it ignors the resources

Vlad
Telerik team
 answered on 10 Nov 2009
2 answers
97 views
I setup a simple TileView test application (WPF 2009 Q3 Release).  The tile item does not follow the mouse drag point, especially if mouse acceleration is enabled and the mouse is moved faster.  It happens with multiple rows/columsn but seems most pronounced with a single column such as the code below:    (screenshot attached)  (grabbed first tile item header, moved mouse to bottom, then to top, ended up with blank area at top, mouse pointer at top, tile item 1/2 way up the list.)

Any ideas for fixing this?

 

<Window x:Class="TileViewTest2.Window2" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Window2" Height="800" Width="200 " xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">  
    <Grid> 
            <telerik:RadTileView MaxColumns="1" Height="auto" Name="radTileView1" Width="auto" MaximizeMode="Zero">  
                <telerik:RadTileViewItem Height="auto" Name="radTileViewItem1" Width="auto"/>  
                <telerik:RadTileViewItem Height="auto" Name="radTileViewItem2" Width="auto"/>  
                <telerik:RadTileViewItem Height="auto" Name="radTileViewItem3" Width="auto"/>  
                <telerik:RadTileViewItem Height="auto" Name="radTileViewItem4" Width="auto"/>  
                <telerik:RadTileViewItem Height="auto" Name="radTileViewItem5" Width="auto"/>  
            </telerik:RadTileView> 
    </Grid> 
</Window> 
Tihomir Petkov
Telerik team
 answered on 09 Nov 2009
3 answers
127 views
Hello,

In testing your q3 beta of RadControls for WPF, I believe I have run into a bug with the new TileView control when using it in a WinForm. The TileView control displays properly, however the ability to drag and drop the individual tiles does not work.  This functionality is present when the WPF UserControl containing the TileView is hosted in a WPF Application, however I cannot get it to work when hosting in a WinForm.

Is there something special that I need to do to get the Tileview to function properly in a Windows Form?

Thanks,

Ben
Tihomir Petkov
Telerik team
 answered on 09 Nov 2009
2 answers
138 views
It would be nice to have a comparison between a telerik control and the Microsoft native equivalent if it exists.

It's easier to point management to a web page that illustrates why the telerik control is a better alternative to the built-in control. It would help sell a lot more copies :-)

Thanks,
Ash
Ash
Top achievements
Rank 1
 answered on 09 Nov 2009
1 answer
127 views
I've searched through the forum and documentation but can't seem to find an answer to these styling issues.

1. How to style the header cell background when a column is sorted or the header cell is hovered.

2. How to style the foreground of a selected row

3. How to style the 'column freeze' bar

4. How to style the Horizontal and Vertical Scroll Bars

5. How to style the column filter indicator.

Any tips on these would be very appreciated.

Kalin Milanov
Telerik team
 answered on 09 Nov 2009
7 answers
215 views
Hey all!

Now, clearly this is my problem and not one with the grid however I am just not seeing how I am going wrong. Given the following XAML...

        <telerik:RadGridView Name="radGridView1" AutoGenerateColumns="False" UseAlternateRowStyle="True">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewComboBoxColumn UniqueName="Active" DataMemberBinding="{Binding IsActive}" SelectedValueMemberPath="Value" DisplayMemberPath="Title" /> 
                <telerik:GridViewDataColumn UniqueName="User" DataMemberBinding="{Binding Name}" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 

And the following code to fill it...

        public Window1()  
        {  
            InitializeComponent();  
 
            var activeflaglist = new List<ActiveFlag>();  
            activeflaglist.Add( new ActiveFlag{ Title = "Yes", Value = "Y" } );  
            activeflaglist.Add( new ActiveFlag{ Title = "No", Value = "N" } );  
 
            var userlist = new List<User>();  
            userlist.Add( new User{ IsActive = "Y", Name = "Bob StartsActive" } );  
            userlist.Add( new User{ IsActive = "N", Name = "Fred StartsInActive" } );  
            userlist.Add( new User{ IsActive = "Y", Name = "John StartsActive" } );  
            userlist.Add( new User{ IsActive = "Y", Name = "Alice StartsActive" } );  
            userlist.Add( new User{ IsActive = "N", Name = "Janet StartsInActive" } );  
 
            var activeColumn = (GridViewComboBoxColumn)radGridView1.Columns["Active"];  
 
            activeColumn.ItemsSource = activeflaglist;  
 
            radGridView1.ItemsSource = userlist;  
        } 

If you build the project (the link is below) and then try to use the combo box a crash is instant. What a I missing?

http://drop.io/hidden/wddviyal73bufj/asset/Y29tYm9ib3hlcnJvci16aXA%253D

Ken
Pavel Pavlov
Telerik team
 answered on 09 Nov 2009
3 answers
144 views
Hi,
I have a grid with auto-generated columns, which allows the user to group by any column.  I want to show the number of records for whichever column the user has groups.

In added an event handler for the Grouping event and put this code, but I got an exception (shown below):

private void WipGrid_Grouping(object sender, Telerik.Windows.Controls.GridView.GridView.GridViewGroupingEventArgs e)  
{  
   var countFunction = new CountFunction("count", e.GroupDescriptor.Member, "Total records: ");  
   e.GroupDescriptor.AggregateFunctions.Add(countFunction);  

Then, I realized the constructor with parameters is obsolete, so I tried the following code, but I got the same error
private void WipGrid_Grouping(object sender, Telerik.Windows.Controls.GridView.GridView.GridViewGroupingEventArgs e) 
        { 
            var countFunction = new CountFunction(); 
            countFunction.Caption = "Total records: "
            countFunction.FunctionName = "Count"
            e.GroupDescriptor.AggregateFunctions.Add(countFunction); 
        } 

What am I missing?   How can I implement this feature?

Exception:
System.Reflection.TargetInvocationException was unhandled
  Message="Exception has been thrown by the target of an invocation."
  Source="mscorlib"
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.RoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at Telerik.Windows.Controls.GridView.GridViewItemsControl.RaiseGroupingEvent(IColumnInfo draggedCell, Int32 index, GroupingEventAction groupingEventAction)
       at Telerik.Windows.Controls.GridView.GridViewGroupPanel.Telerik.Windows.Controls.GridView.DragDrop.IDropTarget.Drop(UIElement draggedElement)
       at Telerik.Windows.Controls.GridView.DragDrop.DragDropManager.EndDrag(Boolean drop)
       at Telerik.Windows.Controls.GridView.DragDrop.WpfDragDropManager.EndDrag(Boolean drop)
       at Telerik.Windows.Controls.GridView.DragDrop.DragDropManager.ProcessMouseLeftButtonUp()
       at Telerik.Windows.Controls.GridView.GridViewHeaderCell.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       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)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at Intel.Cqn.Luminis.LuminisEXE.App.Main() in C:\Projects\Source\Luminis\DEV\Luminis\Intel.Cqn.Luminis.LuminisEXE\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.ArgumentException
       Message="An item with the same key has already been added."
       Source="mscorlib"
       StackTrace:
            at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
            at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
            at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
            at Telerik.Windows.Data.Dynamic.ClassFactory.GetDynamicClass(IEnumerable`1 properties)
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionNewExpression(IEnumerable`1 propertyValuesExpressions)
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<CreateMemberBindings>d__0.MoveNext()
            at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
            at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
            at System.Linq.Expressions.ReadOnlyCollectionExtensions.ToReadOnlyCollection[T](IEnumerable`1 sequence)
            at System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression()
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateSelectExpression()
            at Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
            at Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery()
            at Telerik.Windows.Data.QueryableExtensions.GroupBy(IQueryable source, GroupDescriptorCollection groupDescriptors)
            at Telerik.Windows.Data.QueryableCollectionView.CreateView()
            at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
            at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
            at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
            at Telerik.Windows.Data.QueryableCollectionView.get_ItemCount()
            at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
            at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
            at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
            at Telerik.Windows.Data.QueryableCollectionView.RefreshAndRaiseCollectionChanged(NotifyCollectionChangedEventArgs args)
            at Telerik.Windows.Data.QueryableCollectionView.Refresh()
            at Telerik.Windows.Data.QueryableCollectionView.EndDefer()
            at Telerik.Windows.Data.QueryableCollectionView.DeferHelper.Dispose()
            at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformGrouping(String member, Object displayContent, Nullable`1 insertionIndex)
            at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass2a.<GroupingRequested>b__29()
            at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
            at Telerik.Windows.Controls.GridView.GridViewDataControl.GroupingRequested(Object origin, GroupingRequestedEventArgs e)
       InnerException:



Regards,
Marco


Nedyalko Nikolov
Telerik team
 answered on 09 Nov 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?