<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Source=DataSetVM, Path=TreeRelation}"/>
</telerik:RadTreeListView.ChildTableDefinitions>
</telerik:RadTreeListView>
The hierarchy data can be display correctly in TreeListView. Since I am binding the data view to UI with Two Way mode, so I think if I detele one row in data view, the UI will be updated accordingly. But actually, only delete a root item can refresh correctly. Delete sub items on UI cannot refersh, they need additional refersh manually. For example, I have following structure in TreeListView:
Group 1
|_Item 1
|_Item2
Group 2
Delete Group2 in DataSet, UI will remove Group 2 automatically. But if I remove Item 2 in DataSet, UI will not update unless I refersh UI manually.
So my question is does anybody know how to solve this sub items refersh problem? This is very important for us to decide if choose Telerik or not. So please give any clue you may have.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MyLinqObjDataContext db = new MyLinqObjDataContext();
radGridView1.ItemsSource = db.TBLTests;
}
I am leveraging the WPF Telerik libraries for a simple Tab control. Weird enough the exact same code/solution works on my personal computer but gives the following error on my office machine:
Code
<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="900">
<Grid>
<telerik:RadTabControl>
<telerik:RadTabItem Header="Dashboard Summary" Width="200" Background="Gray">
</telerik:RadTabItem>
<telerik:RadTabItem Header="Details" Width="200" Background="Gray" />
<telerik:RadTabItem Header="Policy Tester" Width="200" Background="Gray" />
</telerik:RadTabControl>
</Grid>
</Window>
<
telerik:RadMaskedNumericInput
Value
=
"{Binding Quantity, Mode=TwoWay}"
>
<
telerik:RadMaskedNumericInput.InputBindings
>
<
KeyBinding
Key
=
"Enter"
Command
=
"{Binding DoSomethingCommand}"
/>
<
KeyBinding
Key
=
"Tab"
Command
=
"{Binding DoSomethingCommand}"
/>
</
telerik:RadMaskedNumericInput.InputBindings
>
</
telerik:RadMaskedNumericInput
>
<
Window
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"WpfApplication1.MainWindow"
x:Name
=
"Window"
Title
=
"MainWindow"
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"InstantItemTemplate"
>
<
Rectangle
Width
=
"7"
Height
=
"{Binding ElementName=slider1, Path=Value}"
Fill
=
"Red"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"ItemWithDurationTemplate"
>
<
Rectangle
Margin
=
"0, 0, 0, 5"
Height
=
"20"
VerticalAlignment
=
"Center"
Fill
=
"Green"
/>
</
DataTemplate
>
</
Window.Resources
>
<
DockPanel
LastChildFill
=
"True"
>
<
StackPanel
DockPanel.Dock
=
"Top"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Slider
Minimum
=
"1"
Maximum
=
"1500"
Value
=
"{Binding ElementName=sliderTextBox, Path=Text, Mode=TwoWay}"
TickFrequency
=
"1"
Name
=
"slider1"
Width
=
"600"
/>
<
TextBox
Name
=
"sliderTextBox"
Text
=
"{Binding ElementName=slider1, Path=Value}"
/>
</
StackPanel
>
<
TextBlock
Text
=
"{Binding ElementName=slider1, Path=Value}"
FontSize
=
"20"
FontWeight
=
"Bold"
Height
=
"25"
HorizontalAlignment
=
"Center"
/>
</
StackPanel
>
<
telerik:RadTimeline
x:Name
=
"timeline"
Margin
=
"6"
VerticalAlignment
=
"Top"
PeriodStart
=
"2011/01/01"
PeriodEnd
=
"2011/06/01"
VisiblePeriodStart
=
"2011/01/01"
VisiblePeriodEnd
=
"2011/03/22"
StartPath
=
"Date"
DurationPath
=
"Duration"
VerticalScrollBarVisibility
=
"Auto"
TimelineItemTemplate
=
"{StaticResource ItemWithDurationTemplate}"
TimelineInstantItemTemplate
=
"{StaticResource InstantItemTemplate}"
>
<
telerik:RadTimeline.Intervals
>
<
telerik:DayInterval
/>
<
telerik:WeekInterval
/>
<
telerik:MonthInterval
/>
<
telerik:YearInterval
/>
</
telerik:RadTimeline.Intervals
>
</
telerik:RadTimeline
>
</
DockPanel
>
</
Window
>
CS
using
System;
using
System.Collections.Generic;
using
System.Windows;
namespace
WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
private
List<Item> dataSource;
private
DateTime startDate;
public
MainWindow()
{
InitializeComponent();
dataSource =
new
List<Item>();
startDate =
new
DateTime(2011, 1, 1);
var endDate =
new
DateTime(2011, 6, 1);
Random r =
new
Random();
for
(DateTime i = startDate; i < endDate; i = i.AddMonths(1))
{
for
(
int
j = 0; j < 20; j++)
dataSource.Add(
new
Item() { Date = i, Duration = TimeSpan.FromDays(r.Next(50, 100)) });
}
dataSource.Add(
new
Item() { Date = startDate.AddMonths(3).AddDays(15) });
timeline.ItemsSource = dataSource;
timeline.VisiblePeriodStart = startDate.AddDays(20);
timeline.VisiblePeriodEnd = endDate.AddDays(-20);
}
}
public
class
Item
{
public
TimeSpan Duration {
get
;
set
; }
public
DateTime Date {
get
;
set
; }
}
}