<telerikRTF:RtfDataProvider SetupDocument="RtfDataProvider_SetupDocument" Rtf="{Binding ElementName=rtfControl, Path=RichText,Mode= TwoWay}" UpdateSourceTrigger="PropertyChanged" RichTextBox="{Binding ElementName=rtfControlMain}"/> <telerik:RadRichTextBox x:Name="rtfControlMain" ToolTip="{Binding ElementName=rtfControl,Path=Text,Mode=OneWay}" IsReadOnly="{Binding ElementName=rtfControl,Path=IsReadOnly}" FontFamily="Segoe UI" FontSize="11" DocumentInheritsDefaultStyleSettings="True" Grid.Row="2" Loaded="rtfMain_Loaded"> <telerik:RadRichTextBox.IsSelectionMiniToolBarEnabled> <MultiBinding Converter="{StaticResource booleanLogicalNORConverter}" > <MultiBinding.Bindings> <Binding ElementName="rtfControl" Path="IsReadOnly"/> <Binding ElementName="rtfControl" Path="IsToolBarVisible"/> </MultiBinding.Bindings> </MultiBinding> </telerik:RadRichTextBox.IsSelectionMiniToolBarEnabled> <telerik:RadRichTextBox.Resources> <Style TargetType="TextBlock" /> </telerik:RadRichTextBox.Resources> </telerik:RadRichTextBox><Window x:Class="RadDockingPaneVisibilityBug.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525"> <Grid> <telerik:RadDocking Grid.Row="1"> <telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer> <telerik:RadPaneGroup> <telerik:RadDocumentPane Header="Content" Visibility="Collapsed" CanUserClose="False"> <TextBlock Text="Content" /> </telerik:RadDocumentPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer> <telerik:RadPaneGroup> <telerik:RadPane Header="Service Card Explorer" CanUserClose="False"> <TextBlock Text="Service Card Explorer" /> </telerik:RadPane> <telerik:RadPane Header="Operations Explorer" CanUserClose="False" Visibility="Collapsed"> <TextBlock Text="Operations Explorer" /> </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> </Grid></Window>System.InvalidOperationException was unhandled Message=Cannot call Arrange on a UIElement with infinite size or NaN. Parent of type 'Telerik.Windows.Controls.Primitives.TabStripPanel' invokes the UIElement. Arrange called on element of type 'Telerik.Windows.Controls.RadPane'. Source=PresentationCore StackTrace: at System.Windows.UIElement.Arrange(Rect finalRect) at Telerik.Windows.Controls.Primitives.TabStripPanel.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize) at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.DockPanel.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Border.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize) at System.Windows.Controls.ContentPresenter.ArrangeOverride(Size arrangeSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Documents.AdornerDecorator.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Controls.Border.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) at System.Windows.Window.ArrangeOverride(Size arrangeBounds) at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect) at System.Windows.UIElement.Arrange(Rect finalRect) 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.AnimatedRenderMessageHandler(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.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 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.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.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 RadDockingPaneVisibilityBug.App.Main() in C:\Data\Source\Work\2\Jerrys\ServiceCard\Main\Sandbox\RadDockingPaneVisibilityBug\RadDockingPaneVisibilityBug\obj\x86\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 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: <Window x:Class="HeatMap.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="552" Width="497" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen"> <Grid> <telerik:RadMap Height="auto" HorizontalAlignment="Stretch" Name="radMap1" VerticalAlignment="Stretch" Width="auto" > <telerik:RadMap.Provider> <telerik:BingMapProvider ApplicationId="API_KEY" Mode="Aerial" /> </telerik:RadMap.Provider> <telerik:BingGeocodeProvider ApplicationId="API_KEY" GeocodeCompleted="BingGeocodeProvider_GeocodeCompleted" x:Name="Bing"> <telerik:BingGeocodeProvider.MapControl> <telerik:RadMap Visibility="Hidden" CommandBarVisibility="Hidden"> <telerik:RadMap.SpatialReference> <telerik:SpatialReference AngularUnitOfMeasurement="0" Authority="{x:Null}" CentralMeridian="0" Datum="{x:Null}" DatumAuthority="{x:Null}" FalseEasting="0" FalseNorthing="0" GeoGcs="{x:Null}" LatitudeOfOrigin="0" MaxLatitude="0" MaxLongitude="0" MinLatitude="0" MinLongitude="0" OffsetX="0" OffsetY="0" Primem="0" PrimemAuthority="{x:Null}" ProjectionAuthority="{x:Null}" ScaleX="0" ScaleY="0" SpheroidAuthority="{x:Null}" SpheroidFlattening="0" SpheroidRadius="0" StandardParallel="0" UnitAuthority="{x:Null}" /> </telerik:RadMap.SpatialReference> </telerik:RadMap> </telerik:BingGeocodeProvider.MapControl> </telerik:BingGeocodeProvider> <telerik:InformationLayer Name="dataLayer" > </telerik:InformationLayer> </telerik:RadMap> </Grid></Window><telerik:RadTreeView ItemsSource="{Binding Items}"> <telerik:RadTreeView.ItemContainerStyle> <Style TargetType="telerik:RadTreeViewItem"> <!--<Setter Property="Header" Value="{Binding Path=Item, Converter={StaticResource ClientTreeItemToTextConverter}}"/>--> <Setter Property="IsDropAllowed" Value="{Binding IsDropAllowed, Mode=TwoWay}"/> <Setter Property="IsLoadOnDemandEnabled" Value="{Binding IsLoadOnDemandEnabled, Mode=TwoWay}"/> <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </Style> </telerik:RadTreeView.ItemContainerStyle> <telerik:RadTreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal" Margin="2"> <Image Margin="0 0 4 0" Source="{Binding Path=Item.Type, Converter={StaticResource NodeTypeToImageConverter}}" VerticalAlignment="Center"/> <TextBlock Text="{Binding Path=Item, Converter={StaticResource ClientTreeItemToTextConverter}}" VerticalAlignment="Center"/> </StackPanel> </HierarchicalDataTemplate> </telerik:RadTreeView.ItemTemplate> </telerik:RadTreeView>Hi
I posted that as a support ticket, but if you have an answer for me, feel frre to give it, thank you very much. I'll paste the answer form the support.
I am testing your product. I am trying to make a nested hierarchy inside a radGridView. My code is inspired from both the Getting started documentation and an example you gave about nested hierarchy. Please, see the attached project.
My goal is to show a list of Divisions in a gridView, each division has teams, and each team has some employees.
I have an Employee class:
public class Employee
{
public string FirstName
{
get;
set;
}
public string LastName
{
get;
set;
}
public int Age
{
get;
set;
}
public bool Married
{
get;
set;
}
}
A team class who has a collection of employees:
public class Team
{
private ObservableCollection<Employee> _empl = new ObservableCollection<Employee>();
public ObservableCollection<Employee> Empl
{
get
{ return _empl; }
set
{ _empl = value; }
}
public int Ident
{
get;
set;
}
public string Nom
{
get;
set;
}
public int Place
{
get;
set;
}
}
A division class who has a list of teams:
public class Division
{
public int Id
{
get;
set;
}
public string Name
{
get;
set;
}
public List<Team> Teams
{
get;
set;
}
}
And a DivisionService class, who creates a collection of divisions, populating each division with some teams and some teams with some employees. Here is an excerpt of the class:
public class DivisionsService
{
public static ObservableCollection<Division> GetDivisions()
{
ObservableCollection<Division> divisions = new ObservableCollection<Division>();
Division dA = new Division();
dA.Name = "Division A";
dA.Id = 1;
dA.Teams = new List<Team>();
Team team1 = new Team();
team1.Ident = 1;
team1.Nom = "Team I";
team1.Place = 1;
Employee emp01 = new Employee();
emp01.FirstName = "Maria";
emp01.LastName = "Anders";
emp01.Married = true;
emp01.Age = 24;
team1.Empl.Add(emp01);
Employee emp02 = new Employee();
emp02.FirstName = "Klodia";
emp02.LastName = "Choufleur";
emp02.Married = false;
emp02.Age = 28;
team1.Empl.Add(emp02);
dA.Teams.Add(team1);
Team team2 = new Team();
team2.Ident = 2;
team2.Nom = "Team II";
team2.Place = 2;
Employee emp03 = new Employee();
emp03.FirstName = "Jean";
emp03.LastName = "Bon";
emp03.Married = true;
emp03.Age = 44;
team2.Empl.Add(emp03);
dA.Teams.Add(team2);
(code here)
return divisions;
}
}
The XAML creates the gridview and the data template:
<Window x:Class="TestRadGridView.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">
<Grid>
<telerik:RadGridView x:Name="HierarchicalGridView"
AutoGenerateColumns="False"
MinHeight="386">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Id}"
Header="Id" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
Header="Name" />
</telerik:RadGridView.Columns>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView
Name="teamGrid"
ShowGroupPanel="False"
AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
Header="Id"
DataMemberBinding="{Binding Ident}"/>
<telerik:GridViewDataColumn
Header="Nom"
DataMemberBinding="{Binding Nom}"/>
<telerik:GridViewDataColumn
Header="Place"
DataMemberBinding="{Binding Place}"/>
</telerik:RadGridView.Columns>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView
Name="employeesGrid"
ShowGroupPanel="False">
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>
</Grid>
</Window>
And the code behind the data binding and the relations:
public MainWindow()
{
InitializeComponent();
GridViewTableDefinition TeamsTableDefinition = new GridViewTableDefinition();
TeamsTableDefinition.Relation = new PropertyRelation("Teams");
this.HierarchicalGridView.TableDefinition.ChildTableDefinitions.Add(TeamsTableDefinition);
GridViewTableDefinition emplTableDefinition = new GridViewTableDefinition();
emplTableDefinition.Relation = new PropertyRelation("empl");
TeamsTableDefinition.ChildTableDefinitions.Add(emplTableDefinition);
this.HierarchicalGridView.ItemsSource = DivisionsService.GetDivisions();
}
So, it does not work: I see the divisions, but there are no teams (and of course I can’t see is there are employees in the teams).
If I delete, in the XAML code, the data template, things are a little better: I see Teams in the divisions, but I do not see Employees in teams. Anyway, I need the data template.
So, what I did wrong?
Could-you too, please, say how to access a selected item in a nested grid? Thank you again.
Cordially
Richard
<telerik:RadGridView x:Name="Navigation" AutoGenerateColumns="False" ItemsSource="{StaticResource data}" >this.Navigation.ItemsSource = this.data;