Telerik Forums
UI for WPF Forum
1 answer
801 views
Hello,

I use standard WPF DataGrid for building of dynamically columns  in my 'dgFields'. I want to use telerik GridView.
If greatly simplify my code (for standard DataGrid) then I need similar for RadGridView:


dgFields.Columns.Add(new DataGridTextColumn { Binding = new Binding("Name"), Header = "Column name", IsReadOnly = true });
dgFields.Columns.Add(new DataGridTextColumn { Binding = new Binding("Header"), Header = "Header", IsReadOnly = true });
dgFields.Columns.Add(new DataGridCheckBoxColumn { Binding = new Binding("IsVisible"), Header = "Is Visible", IsReadOnly = false });
dgFields.Columns.Add(new DataGridTextColumn { Binding = new Binding("Description"), Header = "Description", IsReadOnly = true, MinWidth = 258 });
 
foreach (var column in myObject.HyperlinkColumns)
{
    var style = new Style(typeof(TextBlock));
    style.Setters.Add(new EventSetter(Hyperlink.ClickEvent, (RoutedEventHandler)EventSetter_OnHyperlinkClickEventHandler));
    dgFields.Columns.Add(new DataGridHyperlinkColumn { Binding = new Binding(column.Name), Header = column.Header, ElementStyle = style });
}


I need Text, Hyperlink and CheckBox columns with binding.

Thanks,
Dmitry
Vitaly
Top achievements
Rank 1
 answered on 31 May 2012
0 answers
163 views
Hello everyone,

I am currently programming an automation tool using the new native Microsoft UI
Automation API 3.0 (using VC++ 2010, native C++, Win7). The Application
Under Test (AUT) is a WPF application containing some Telerik controls
(particularly RadDocking, RadSplitContainer, RadGroup, RadPane).

UIA works fine - I can install event handlers, navigate through the tree,
search elements using various conditions and control the found elements
using their patterns.

However recently I encountered a behaviour that leaves me baffled: The UIA tree of
my AUT simply is not up-to-date after switching the central RadPane's
content.

After switching the RadPane's content, I can *see* the new controls in the
AUT's GUI but the UIA tree still reflects the controls that have been there
before. The (outdated) UIA sub-tree can be still completely read using UIA
search functions or using a UIA walker but of course it can not be written
since the underlying controls do not exist anymore.

I was not able to force an update of the the UIA sub-tree; neither by
calling any UIA functions nor by restarting the tester application or by
switching the RadPane's content back and forth.

The issue happens only if my tester application does access the
RadPane's UIA sub-tree before it is switched. I.e. the system seems to
memorize the RadPane's UIA sub-tree and keeps the old elements even after
switching the RadPane's content.

This exactly looks like there would be an outdated cache... however I do NOT
use any caching UIA functions at all. None. Never. Nowhere.

Currently I found only one mysterious, cumbersome way to update the RadPane's
UIA sub-tree reliably: Using one of the Microsoft tools "Inspect" or
"UISpy"! E.g. when using the Inspect tool having a brief look into RadPane's
UIA sub-tree (by click-expanding the corresponding node in the tree), the
problem is suddenly gone and my tester application can access the actual,
RadPane's up-to-date UIA sub-tree immediately! Of course this is a temporary
solution only.

I have no idea what Inspect/UISpy is doing to update the UIA tree of an
unrelated application.
Inspect.exe uses the same native interface as I do but UISpy.exe uses the
.NET interface AFAIK so this seems not to depend from the used Microsoft
API. BTW, the tool "Snoop" does not have this effect.

I really need help. Currently I am unable to locate the origin of the
problem. On the one hand this problem happens with Rad controls (and their
content) only, on the other hand the Microsoft tools seem to do the trick
somehow. So I suppose there is some detail I have to know when automating
Rad controls via UIA.

Does anyone have an idea how to approach the problem?

Thanks in advance,
Bernhard
Bernhard
Top achievements
Rank 1
 asked on 30 May 2012
1 answer
83 views
If I add a Column Header or Footer to a GridViewColumn an InvaidOperationException is thrown with a message of "Specified element is already the logical child of another element. Disconnect it first." when I attempt to change the Theme. If I comment out the footer, there is no exception and the theme changes as expected.

Below is the xaml for the RadGridView and following that is the exception details.

<telerik:RadGridView AutoGenerateColumns="False"
                     Width="498"
                     ShowGroupPanel="False"
                     Margin="0,5,0,0"
                     Height="200"
                     ItemsSource=" "
                     ShowColumnFooters="True"
                     telerik:StyleManager.Theme="{Binding TelerikTheme}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewColumn Header="Period"
                                Width="150">
            <telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="Some Data" />
                </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
            <telerik:GridViewColumn.Footer>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Period Range"
                               FontWeight="Bold" />
                </StackPanel>
            </telerik:GridViewColumn.Footer>
        </telerik:GridViewColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

System.InvalidOperationException was unhandled
  Message=Specified element is already the logical child of another element. Disconnect it first.
  Source=PresentationFramework
  StackTrace:
       at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
       at System.Windows.FrameworkElement.AddLogicalChild(Object child)
       at System.Windows.Controls.ContentControl.OnContentChanged(Object oldContent, Object newContent)
       at System.Windows.Controls.ContentControl.OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.GridView.GridViewFooterRow.PrepareCellProperties(GridViewFooterCell cell, GridViewColumn column) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Rows\GridViewFooterRow.cs:line 277
       at Telerik.Windows.Controls.GridView.GridViewFooterRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Rows\GridViewFooterRow.cs:line 220
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(GridViewCellBase cell, GridViewColumn column) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 410
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn column, Boolean createIfNull) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.Virtualization.cs:line 399
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32 startIndex, Int32 predictedLastIndex, Func`2 calculateNextIndex) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.Virtualization.cs:line 334
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells() in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.Virtualization.cs:line 269
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size availableSize) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 306
       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.Controls.Border.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 Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size constraint) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Rows\GridViewRowItem.cs:line 215
       at Telerik.Windows.Controls.GridView.GridViewFooterRow.MeasureOverride(Size availableSize) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\Rows\GridViewFooterRow.cs:line 172
       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.Controls.ScrollViewer.MeasureOverride(Size constraint)
       at Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(Size constraint) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\ScrollViewer\GridViewScrollViewer.cs:line 179
       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.Controls.Border.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 Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size constraint) in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 6576
       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.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, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(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, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       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.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
       at AM.NET.App.Main() in C:\Dev\Genesis\AM.NET\AM.NET\obj\Debug\App.g.cs:line 50
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Hopefully there is a work around.

Thank you in advance
Steve
Steve
Top achievements
Rank 1
 answered on 30 May 2012
5 answers
150 views
Hello,

I am using your (Telerik) Bar_Rating_WPF custom control for bar graph style ratings. Everything displays well and the click action selects the proper rating bar. Where I am having difficulty is setting or getting a value. I don't see how I can set a datacontext?

FWIW I add the control at runtime:
Bar_Rating_WPF uctrl_ConfOpn = new Bar_Rating_WPF();
grd_ConfOpn.Children.Add(uctrl_ConfOpn);

I'm not going to put the whole source code for the Bar_Rating_WPF user control here as 1. it came from you (Telerik) and 2. it's quite lengthy.

Thank You
JB

Tina Stancheva
Telerik team
 answered on 30 May 2012
1 answer
126 views
Hello!

We have issue with RadWindow used as dialog. This problem is observed on Windowx XP only (we checked on two different computers). It's not observed in Windows 7 (we also checked on two different computers). The issue looks like this: 
  • Show modal dialog with title.
  • Press ALT+Tab
  • See empty text in Alt Tab manager (see screen shot)
We need to solution for Windows XP which eliminates observed effect. 


Georgi
Telerik team
 answered on 30 May 2012
6 answers
323 views
Hi,

We are having a slight issue trying to find a solution for the following issue:

We have a Horizontal Bar Chart, using the RadChart in WPF, and have set the screen up so that the chart proportionally resizes with the resizing of the screen.  The issue that we have is that although we can manually set the ScrollMode, RangeStart and RangeEnd so that the axis labels and the chart values are clearly visible and do not overlap, when the user resizes the screen (and subsequently the chart) the axis labels start to overlap and we loose some of the bar values.

Ideally we are looking for a solution that would allow the chart to dynamically set the ScrollMode, RangeStart and RangeEnd values so that the bars on the chart are always shown at the optimal height to remain clear (or to abide to a minimum height).

Any help on this would be greatly appreciated.

Thanks in advanced

Carl
PSP IT Design & Development
Carl
Top achievements
Rank 1
 answered on 30 May 2012
0 answers
89 views
I can sort columns programmatic like the example in documentation using ColumnSortDescriptors
http://www.telerik.com/help/wpf/gridview-sorting-programmatic.html
Also I have a Custom Sorting defined using the GridView Sorting event:
this.radGridView.Sorting += this.radGridView_Sorting; 
http://www.telerik.com/help/wpf/gridview-sorting-custom.html
This event only is fired when the user click in the column header it's not fired automatic. How can I apply custom Sorting automatic?

Thank you. 
Jordi
Top achievements
Rank 1
 asked on 30 May 2012
1 answer
97 views
I'm setting the PeriodEnd on the Timebar control without any time component, i.e. 3/7/2011 12:00:00 AM.  When selecting dates on the UI, I can only select until 3/6/2011?  Is there a way to change this to display/select the PeriodEnd being passed in? I'm by default selecting the full date range (PeriodStart - PeriodEnd). 
Yavor
Telerik team
 answered on 30 May 2012
1 answer
84 views
Hello. I'm trying to change the standard behaviour of LeftClick (zoom) to RightClick, and also stop the event from firing on left click so I can set up my own behaviour. Is this possible?

Regards,
Dan
Giuseppe
Telerik team
 answered on 30 May 2012
2 answers
130 views
Hello,

I've got a problem with a gridview.

The first cell is set to IsReadOnly=true, so the cursor starts at the 2nd cell, but when I press tab the focus is on the "frame" of cell 3, not inside it, and i'm unable to tab to the next cell or type anything in the cell. I have to click with the mouse inside the cell, and then everything works fine.

I've attached 2 screen shots.

Any ideas/solutions to this problem?

Cheers
Kasper
Top achievements
Rank 2
 answered on 30 May 2012
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?