Telerik Forums
UI for WPF Forum
3 answers
360 views

I have a RadGridView:

<Telerik:RadGridView Name="recordGrid"  ItemsSource="{Binding RecordList,Mode=TwoWay}" SelectedItem="{Binding CurrentRecord,Mode=TwoWay}" ShowGroupPanel="False" AutoGenerateColumns="True" AutoGeneratingColumn="RadGridView_AutoGeneratingColumn">
</Telerik:RadGridView>

As you can see, the grid is bound to a DataTable object called RecordList and the SelectedItem is bound to a DataRow object called CurrentRecord. The RecordList DataTable is generated dynamically and can have any combination of user-defined columns and rows. Because I don't know the columns ahead of time, I use AutoGenerateColumns to take care of that.

The first column will always be an ID column that identifies the row and is hidden from the user by canceling the AutoGenerateColumn event whenever the column header is "ID". The rest of the columns are user defined. 

Up to there, it all works. The problem comes when I need to create a custom column type to be auto-generated. Some columns, as defined by the user, need to display other UI controls such as buttons in the cell. To do this, I've created a RecordColumn class that extends Telerik.Windows.Controls.GridViewColumn. It is defined as follows:

public class RecordColumn : Telerik.Windows.Controls.GridViewColumn
   {
       public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
       {
           StackPanel cellData = new StackPanel();
           return cellData;
       }
   }

Nothing fancy at the moment. Just trying to get it working so all it does is return an empty StackPanel to go in the cell when it's created. 

Now, here's my AutoGeneratingColumns event code, which I use to instantiate the RecordColumn.

private void RadGridView_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
    String headerText = e.Column.Header.ToString();
    if (headerText == "ID")
    {
        e.Cancel = true;
    }
    else
    {
        if (!(e.Column is RecordColumn))
        {
            RecordColumn rc = new RecordColumn(); 
            rc.Header = headerText;
            e.Column = rc;
        }
    }
}

The first time the RadGridView is loaded, everything looks fine. The user-defined columns are displayed as expected. If I do anything that causes the RecordList DataTable binding to update (such as adding or deleting a row), the AutoGeneratingColumns event fires again and doubles the columns. I can keep doing this, causing the columns to double every time. 

I can trace the AutoGeneratingColumns event being fired each time and it always (except for the "ID" column) goes into the code that creates a new RecordColumn. I'm guessing that's where it's creating the extra columns each time. Looking through the e.Column object though, I don't see anything that tells me I don't need to generate this column again. Each time the column type is RadGridViewColumn even if I've previously changed them all to RecordColumn, so that doesn't work. 

I have verified that my DataTable on the back-end only contains one set of the columns. This is purely on the UI side. 

If I don't use the custom column, everything works fine and when I update the binding the columns don't duplicate. 

Vlad
Telerik team
 answered on 18 Mar 2011
1 answer
224 views
I'm using several RadTabItems who's content is loaded when the tab is selected the first time.

From a visual point of view, everything works fine, the right content is displayed. However, I would like to automate some UI tests on these RadTabItems which does not work.

-I see the RadTabItems with the UISpy
-If I select a RadTabItem, the correct content is displayed but the corresponding container in the UISpy is not shown. The UISpy is not notified about the changed content.
-If I open a pop-up in my application under test, close it, the UISpy sees the content of the RadTabItem
-If I simply replace the RadTabItem by a standard WFP TabItem, everything works as expected.


Hristo
Telerik team
 answered on 18 Mar 2011
1 answer
89 views
Hi,

I am developing a hierarchical data grid where by the values of the parent row can show/hide certain columns. I did setup a bindable value from the parent row's object  to the IsVisible property of the GridViewDataColumn but the binding never gets invoked even though all conditions are met correctly. How do I go about achieving this?

Thanks,
Farhan
Maya
Telerik team
 answered on 18 Mar 2011
1 answer
53 views
Hi, I am wondering, why ScheduleView is so much different to Scheduler?

So I have some questions:

1) Is there a way that ScheduleView's Timeline View (which is completely different) has the same look as the Scheduler's Timeline View?
2) The Scheduler provides events, which are fired, when the View Mode is changed (ActiveViewDefinitionChanged), or when the Selected View Start Date changed (SelectedViewStartDateChanged). Where are these events in ScheduleView?

Please answer me as soon as possible.

Thanks,
Ronald
Valeri Hristov
Telerik team
 answered on 18 Mar 2011
5 answers
170 views
Hey,

I can't display the correct x-axis date value in the itemtooltip.
Here are the interesting facts for you...

I have a chart with thousands of points so i use:
<telerik:AxisX AutoRange="True"...


That's why in my ItemToolTip the first value works and the last not (because of this link this link):
<telerik:LineSeriesDefinition ItemToolTipFormat="#X --> #DATAITEM.Date or #DATAITEM.Date{MM/dd/yyyy}"...


But I can't use #X because it's from double type and the result is something like "42k" - but not a date!

What kind of solution you can offer for my problem? Is there a posibility to convert the double to string inside xaml?
(i can't use codebehind...)

P.S. Sorry but I realized to late that I've posted this thread in WPF - its for Silverlight!!!
Evgenia
Telerik team
 answered on 18 Mar 2011
1 answer
82 views
Hello :)

I have found a problem that goes like this:

I have a gridview that is bound to a observable collection of business objects.
The gridview properties:

<telerik:RadGridView x:Name="ReservasGridView"
                Margin="0"
        IsReadOnly="False" CanUserFreezeColumns="False" CanUserInsertRows="True"
        SelectionMode="Single" AutoGenerateColumns="False"
                IsFilteringAllowed="False" ShowGroupPanel="false" MaxHeight="768"
        IsSynchronizedWithCurrentItem="True"
>

Everything works as expected, but when I edit and commit an existing row, the first row of the gridview renders a few rows down. This not happens all the time, but it certainly happens, and I don't know why.

I have attached a jpg file showing this behavior.
I hope you can help me.

Best regards
Jorge
Vlad
Telerik team
 answered on 18 Mar 2011
2 answers
202 views
I would like to display the columns of a DataRow in more than one row of the GridView.

Something like

HeaderRow            Last Name        First Name
                                Phone                Email

Row 1                    Bill                    Smith
                                719-999-9999 Bill@jk.com

Row 2                    Joe                    Brown
                                203-000-0000 Joe@br.com

Thanks
Radha
James
Top achievements
Rank 1
 answered on 18 Mar 2011
1 answer
89 views
Hi there,

after updating to the q1 2011 release the interactivity feature is not working anymore. even in your controls demonstrating app.

please see attached screenshots.

picture 1: 2 countries are selected, nothing happens in the chart
picture 2: the mouse is over a red bar, no dimming of the others series

this bug occurs also in my own project using the chart component and 

var ds = new DataSeries();
ds.Definition.ShowItemToolTips = true;
ds.Definition.InteractivitySettings.HoverScope = InteractivityScope.Series;
ds.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Series;

it works in the previous release. is this a bug or a feature? ^^

best wishes,

Giuseppe
Telerik team
 answered on 17 Mar 2011
1 answer
170 views

Hello,

per default the culture of the RadMaskedNumericInput is set to en-US, changing that to a suitable value initially is easy enough. But how do I use the system-culture instead?

Setting the culture for every single control (and there will be hundreds of them) when the program is started is hardly the way to go. I tried using the value "(Standard)" from the selection of cultures available in the culture-property, but that is not an excepted value for that property.

I'm currently using the trial version of the 2011 Q1 release.

Alex Fidanov
Telerik team
 answered on 17 Mar 2011
3 answers
88 views
Last night I downloaded and installed the RadControls for WPF 2011.1 315 (Mar 16, 2011). The upgrade wizard would not allow me to upgrade my project to this version, it would only allow me to select 2010 Q3, so I manually browsed to the DLLS and then upgrade from it. (C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2011\Binaries\WPF)

Now, when I rebuild my project (which was working just fine) I get the following error:

System.NullReferenceException
Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.TileViewPanel.UpdateScrollViewer() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TileView\TileViewPanel.cs:line 359
   at Telerik.Windows.Controls.TileViewPanel.MeasureOverride(Size availableSize) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TileView\TileViewPanel.cs:line 270
   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 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ScrollContentPresenter.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.ScrollViewer.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.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.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at Telerik.Windows.Controls.TransitionControl.TransitionPresenter.MeasureOverride(Size availableSize) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\TransitionControl\TransitionPresenter.cs:line 321
   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.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.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 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.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.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.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.Documents.AdornerDecorator.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.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.DockPanel.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.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.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Designer.ZoomableViewPresenter.DesignerBackground.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize)
   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.ScrollContentPresenter.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.ScrollViewer.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 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.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.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at MS.Internal.DeferredHwndSource.ProcessQueue(Object sender, EventArgs e)

Regards,

Jeremy
Zarko
Telerik team
 answered on 17 Mar 2011
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?