Telerik Forums
UI for WPF Forum
5 answers
676 views
I'm seeing an odd error with the grouping in the RadGridView. It's worth pointing out that the data is being displayed and grouped properly despite the error. However, I still want it resolved.

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Columns[ContactType]; DataItem=null; target element is 'ColumnGroupDescriptor' (HashCode=34214014); target property is 'Column' (type 'GridViewColumn')

Below is the relevant portion of my XAML. The extra columns have been elided as is the rest of the visual tree. I get the same problem if it's in different parts of the visual tree and even with just the one column.

​<telerik:RadGridView x:Name="ContactsGridView"
                        ItemsSource="{Binding Employee.Contacts}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn Header="Type" UniqueName="TypeColumn"
                                        ItemsSource="{Binding ContactTypesView}"
                                        DataMemberBinding="{Binding ContactTypeId}"
                                        SelectedValueMemberPath="Id" DisplayMemberPath="TypeName"
                                        EditTriggers="CellClick" ShowColumnWhenGrouped="False" />
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.GroupDescriptors>
        <telerik:ColumnGroupDescriptor Column="{Binding Columns[\TypeColumn\], ElementName=ContactsGridView}"
                                        SortDirection="Ascending" />
    </telerik:RadGridView.GroupDescriptors>
</telerik:RadGridView>

I have a style that governs the several grids in my window. Here is that XAML:

<Style TargetType="{x:Type telerik:RadGridView}">
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="GridLinesVisibility" Value="None" />
    <Setter Property="ShowGroupPanel" Value="False" />
    <Setter Property="RowIndicatorVisibility" Value="Collapsed" />
    <Setter Property="RowDetailsVisibilityMode" Value="Collapsed" />
    <Setter Property="AutoGenerateColumns" Value="False" />
    <Setter Property="CanUserFreezeColumns" Value="False" />
    <Setter Property="SelectionUnit" Value="FullRow" />
    <Setter Property="AutoExpandGroups" Value="True" />
    <Setter Property="GroupRenderMode" Value="Flat" />
</Style>

Any ideas of what might be causing this error? I created a stripped down solution and couldn't duplicate the error message.
Aliaster
Top achievements
Rank 1
 answered on 03 May 2017
11 answers
440 views
Hey, Guys
This tough to describe. In Brief, I want the RadDiagram has the circuit diagram feature like the attached picture. The certain connector can connect to line (or named as RadDiagram connection).  Is any approaching to this feature?

Thanks a lot, By William
Robert
Top achievements
Rank 1
 answered on 03 May 2017
4 answers
109 views

Dear Telerik,

I encountered pretty weird behavior  while using VirtualQueryableCollectionView+grid.

I have  a grid and a simple combobox for filtering. When I select a value in the combobox everything works as expected:

-- selected combobox value changed

-- handle property change event in the model

-- set collection total and reload required page

However if i click any cell I can see that virtual collection reloads ALL the pages. I attached a small repro u can play with.

Scenario 1: start the app - select a unit from the combobox - click any cell (e.g. top left cell) - check the output

Scenario 2: start the app - click the button - click any cell (e.g. top left cell) - check the output

-- 

Here is the xaml

 

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />

</Grid.RowDefinitions>

<telerik:RadButton Content="reload" HorizontalAlignment="Left" Margin="2" Command="{Binding ReloadCommand}" />

<telerik:RadComboBox  ItemsSource="{Binding Units}" HorizontalAlignment="Right" Margin="2"
EmptyText="select unit" SelectedItem="{Binding Unit, Mode=TwoWay}"/>

<telerik:RadGridView  AutoGenerateColumns="False" ShowGroupPanel="False" 
ItemsSource="{Binding Data}" Grid.Row="1" IsReadOnly="True"  >
<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn DataMemberBinding="{Binding RowNo}" Header="row no" />

</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</Window>

Here is the model

 

#region Usings
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows.Input;
using Telerik.Windows.Data;
#endregion

namespace WpfApplication1
{
public class Model
{
#region Class constants
private const int PAGE_SIZE = 100;
#endregion

#region Class members
private UnitType _unit;
protected VirtualQueryableCollectionView _data;
#endregion

#region Class properties
public IEnumerable<UnitType> Units
{
get
{
return Enum
.GetValues( typeof( UnitType ) )
.Cast<UnitType>()
.ToList();
}
}
public UnitType Unit 
{
get 
{
return _unit;
}
set 
{
_unit = value;

LoadHistory();
}
}
public VirtualQueryableCollectionView Data
{
get
{
return _data;
}
}
public CommandHandler ReloadCommand { get; set; }
#endregion

#region Class initialization
public Model() 
{
_data = new VirtualQueryableCollectionView()
{
LoadSize = 100
};

_data.ItemsLoading += ( o, ea ) => OnNeedDataPage( ea.StartIndex / _data.LoadSize );

ReloadCommand = new CommandHandler( x => LoadHistory(), true );
}
#endregion

#region Class event handlers
private void LoadHistory()
{
_data.ResetItems();
LoadHistory( 0 );
}
protected void OnNeedDataPage( int iPageIndex )
{

LoadHistory( iPageIndex );
}
private void LoadHistory( int iPageIndex )
{
var iTotalCount = 1000;
Debug.WriteLine( "load glass history page: " + iPageIndex );

if( iTotalCount != _data.VirtualItemCount )
{
_data.VirtualItemCount = iTotalCount;
}

int iStartIndex = iPageIndex * PAGE_SIZE;
var list = new List<TestData>();

for( int i = iPageIndex * PAGE_SIZE; i < iPageIndex * PAGE_SIZE + PAGE_SIZE; ++i )
{
list.Add( new TestData() { RowNo = i } );
}

_data.Load( iStartIndex, list );
}
#endregion

#region Class internal structs
public enum UnitType 
{
none,
a,
b
}
public class TestData
{
public int RowNo { get; set; }
}
#endregion
}

public class CommandHandler:ICommand
{
#region Class members
protected Action<object> _action;
protected bool _canExecute;
#endregion

#region Class events
public event EventHandler CanExecuteChanged;
public void FireCanExecuteChanged( bool b )
{
_canExecute = b;

if( null != CanExecuteChanged )
{
CanExecuteChanged( this, EventArgs.Empty );
}
}
#endregion

#region Class initialization
public CommandHandler( Action<object> action, bool canExecute )
{
_action = action;
_canExecute = canExecute;
}
#endregion

#region Class public methods
public bool CanExecute( object parameter )
{
return _canExecute;
}
public void Execute( object parameter )
{
_action( parameter );
}
#endregion
}
}

 

Stefan
Telerik team
 answered on 02 May 2017
6 answers
222 views
I'm getting null ref error when i move from one cell to another in a rad grid view. This started happening once i move from version from 2011.1.419.35 to 2011.2.920.40.

Steps to reproduce

Create a grid so that columns so that all columns are not visible.
Bind the a column to an int/decimal value (<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=OrderUnits, Mode=TwoWay}" UniqueName="QuantityColumn" Header="Quantity" />)
enter edit mode in this column
scroll to the end of the grid view so that this column is out of view
scroll back to original location
tab out of edit.

Version - 2011.2.920.40
WPF4



Stack trace below.

   at Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseDataErrorEvent(DataErrorEventArgs args)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCurrentEdit(GridViewRow gridViewRow)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformRowEditEnded(GridViewCell currentCell)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCellEdit(GridViewCell currentCell, Boolean isLeavingRow)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitEdit()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCommitEditCommand(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PendAndExecuteCommands(KeyEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   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)
Robert
Top achievements
Rank 1
 answered on 02 May 2017
3 answers
154 views

Hello everyone,

I'm currently stucked with the following situation.

I'm generating via a ViewModel the shapes for my toolbox. This is done via a property binding.

01.Public ReadOnly Property CostCenterToolbox As ObservableCollection(Of DiagramGallery)
02.    Get
03.        Dim galleryCollection = New ObservableCollection(Of DiagramGallery)()
04.        Dim gallery As New DiagramGallery With {.Header = "Cost centers"}
05. 
06.        costCenterDataTable = ParameterProduction.Instance.Open_ParCostCenter
07.        For Each row As DataRow In costCenterDataTable
08.            Dim node = New WorkflowCostCenterNode With
09.                {
10.                    .Content = row.Item("costCenter") & vbCrLf & row.Item("Description"),
11.                    .TreeId= 0,
12.                    .ProcessId = 0,
13.                    .CostCenter = row.Item("costCenter"),
14.                    .Description = row.Item("Description")
15.                }
16.            gallery.Shapes.Add(node)
17.        Next
18.        galleryCollection.Add(gallery)
19. 
20.        Return galleryCollection
21.    End Get
22.End Property

On the right side of the toolbox there is my diagram, which initially loads an existing workflow.

Now the problem is, that when dragging a shape from the toolbox to the diagram the dropped shape doesn't have any information about the node properties I gave it (in this case TreeId, ProcessId, CostCenter, Description are all Nothing).
As the documentation says, I need to serialize my custom properties, so that the diagram recognizes them.
The initially loaded workflow to the diagram is done via a GraphSource, which works perfectly (with the same node properties from above). In the GraphSource class I have those SerializeNode and DeserializeNode methods overriden.
But for the toolbox the nodes aren't in a graph source but added directly to the gallery and then to the gallerycollection (see code snippet above).

This might be the problem.
Is it possible to create the nodes, add them to a graph source object and then add them to the toolbox gallery?

Otherwise, how can I achieve, that when dragging the shape (initially created with the node and custom properties) from the toolbox to my diagram, that the node behind the shape has the custom property values I've initially set. Maybe the node properties are already lost, when the shapes are loaded into the toolbox?

I've read the following documentations without success :-(
- http://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/drag-custom-toolboxitem

- http://docs.telerik.com/devtools/wpf/controls/raddiagram/features/raddiagrams-serialization#manual-serializationdeserialization

- http://docs.telerik.com/devtools/wpf/controls/raddiagram/extensions/toolbox#how-to-populate-raddiagramtoolbox-with-custom-data-items

Any hints and maybe short examples are very welcome

Timon
Top achievements
Rank 1
 answered on 02 May 2017
1 answer
125 views
Hello guys,

I'm trying to get the points inside a polygon with an spatial query, the thing is that the points and the polygon are in the same SQL Table, I'm attaching a picture with the result of a Select Query (image attached) where you can see that the last 3 records are the polygons that contains points.

I've tried this with one point but it won't work because I need a list with the names of the polygons and the points inside of it in a spatial query.

        DECLARE @POI geography;  
        DECLARE @POLYGON geography;  
        SET @POI = (SELECT TOP 1 GEO FROM POI WHERE LAYERID <> 1026);
        SET @POLYGON = (SELECT TOP 1 GEO FROM POI WHERE LAYERID = 1026);
        SELECT @POLYGON.STContains(@POI);
Petar Mladenov
Telerik team
 answered on 02 May 2017
1 answer
105 views
I'm trying to put Map Polygons on the InformationLayer of a map, successfully it does the work but it paints a 4th polygon joining all the previous ones, as shown in the attached image. (the three polygons are the ones that doesn't touches between them).
Petar Mladenov
Telerik team
 answered on 02 May 2017
3 answers
127 views

Can somebody point me towards examples for initializing the child/parent relationship for diagram nodes derived from HierarchicalNodeViewModel? This example code from the MVVM serialization example (http://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/raddiagrams-serialize-databound-diagram) results in a Children property with 0 entries for the rootNode:

private void BindGraphSource()
{
    int uniqueIdCounter = 0;
    GraphSource source = new GraphSource();
    OrgItem rootItem = new OrgItem() { Title = "CEO", Position = new Point(200, 20), Id = (uniqueIdCounter++).ToString() };
    source.AddNode(rootItem);
 
    OrgItem unitOne = new OrgItem() { Title = "Unit Manager USA", Position = new Point(100, 100), Id = (uniqueIdCounter++).ToString() };
    source.AddNode(unitOne);
    source.AddLink(new OrgLink(rootItem, unitOne) { Id = (uniqueIdCounter++).ToString() });
 
    OrgItem unitTwo = new OrgItem() { Title = "Unit Manager Europe", Position = new Point(300, 100), Id = (uniqueIdCounter++).ToString() };
    source.AddNode(unitTwo);
    source.AddLink(new OrgLink(rootItem, unitTwo) { Id = (uniqueIdCounter++).ToString() });
 
    this.xDiagram.GraphSource = source;
}

 

Manually setting the children doesn't seem straighforward, either: Even though the doc for the HierarchicalNodeViewModel.Children property reads "Gets or sets the children of the current node", the property only has a getter and no setter:

public ObservableCollection<HierarchicalNodeViewModel> Children { get; }
Matthias
Top achievements
Rank 1
 answered on 02 May 2017
4 answers
475 views

So I often use the BusyIndicator in my application to provide a nicely styled modal window with overlay. I am attempting to add a BusyIndicator to a view that already has 5 others set up to cover the whole view. They are not nested; they all cover the same grid rowspan. I copied the code from another already on the page and gave it a new name. I can't see any difference in the code.

For some reason this new busy indicator is blocking access to my view while it is set to IsBusy="False". It is not applying the styled colour overlay or showing the modal itself, but I can't click on any buttons or interact with the screen at all.

 

    <Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <telerik:RadBusyIndicator Grid.RowSpan="4" x:Name="SecurityAnswers" IsBusy="False" OverlayStyle="{StaticResource BusyIndicator_OverlayStyle}" ProgressBarStyle="{StaticResource BusyNoProgress}">
            <telerik:RadBusyIndicator.BusyContent>
                <StackPanel>
                    <!-- This is the indicator that works perfectly. There are 5 similar to this one that all work fine. -->
                </StackPanel>
            </telerik:RadBusyIndicator.BusyContent>
        </telerik:RadBusyIndicator>

        <telerik:RadBusyIndicator Grid.RowSpan="4" x:Name="SelectUserLocation" IsBusy="False" OverlayStyle="{StaticResource BusyIndicator_OverlayStyle}" ProgressBarStyle="{StaticResource BusyNoProgress}" >
            <telerik:RadBusyIndicator.BusyContent>
                <Grid >
                    <!-- this is the indicator that is causing the problems! I can't see anything to explain the different behaviour -->
                </Grid>
            </telerik:RadBusyIndicator.BusyContent>>
        </telerik:RadBusyIndicator>
    </Grid>

  

I have moved the offending BusyIndicator above and below the others, and I have removed all the others to see if there was an issue due the number of indicators on the screen. Even if its the only BusyIndicator on the screen, it still blocks the screen while not busy!

I have also tried removing the styles, the problem continues. The only thing that solves the problem is removing that one BusyIndicator

 

Any insight into this issue would be greatly appreciated! thanks

jen
Top achievements
Rank 1
 answered on 01 May 2017
1 answer
109 views

I have a complex template defining the RadPanelBar & RadPanelBarItem. I want to have these items be virtualized as I expect there to be about 1000 items and it takes enormous amount of time for my screen to load.

I know that RadPanelBar did not support virtualization previously, but is there a way to do it now? Below is my control template

------------------------------------------------------------------------------------------------------------------------------------------------------

<this:RadPanelBar x:Name="ContainerBar"
                                    Grid.Row="1"
                                    ItemsSource="{Binding Path=TheCollection}"
                                    HorizontalAlignment="Stretch"
                                    Background="{StaticResource StrongestBrush}"
                                    Orientation="Vertical"
                                    ExpandMode="Multiple"
                                    SelectionMode="Multiple">
                    <telerik:RadPanelBar.ItemContainerStyle>
                        <Style TargetType="this:RadPanelBarItem"
                               BasedOn="{StaticResource ResourceKey={x:Type this:RadPanelBarItem}}">
                            <Setter Property="IsExpanded"
                                    Value="{Binding Path=IsExpanded,
                                                Mode=TwoWay}" />
                        </Style>
                    </telerik:RadPanelBar.ItemContainerStyle>
                    <telerik:RadPanelBar.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Path=TheMatchingItems}"
                                                  ItemTemplate="{StaticResource DesignerHotButtonTemplate}">
                            <TextBlock Text="{Binding Path=TheHotButtonType, 
                                                      Converter={x:Static this:ButtonTypeConverter.TheInstance}}" />
                        </HierarchicalDataTemplate>
                    </telerik:RadPanelBar.ItemTemplate>
                </this:RadPanelBar>

------------------------------------------------------------------------------------------------------------------------

---------------------- control template --------------------------------

  <ControlTemplate TargetType="telerik:RadPanelBar">
                    <Grid>

                        <telerik:LayoutTransformControl x:Name="transformationRoot">
                            <Border BorderThickness="{TemplateBinding BorderThickness}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    Background="{TemplateBinding Background}">
                                <ScrollViewer x:Name="ScrollViewer"
                                              IsTabStop="False"
                                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                              BorderBrush="Transparent"
                                              BorderThickness="0"
                                              Padding="{TemplateBinding Padding}"
                                              Margin="0"
                                              telerik:StyleManager.Theme="{StaticResource Theme}"
                                              HorizontalScrollBarVisibility="Auto"
                                              VerticalScrollBarVisibility="Auto"
                                              CanContentScroll="True">
                                    <ItemsPresenter />
                                </ScrollViewer>
                            </Border>
                        </telerik:LayoutTransformControl>
                    </Grid>
                </ControlTemplate>

Martin Ivanov
Telerik team
 answered on 28 Apr 2017
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?