I have a RadTreeView with some Containers and some Items (the items do not contain other items). When I activate Drag and Drop everything works fine. My problem is that I have some Containers that should not work as drop target. Unfortunatly I could not find an example.
First I tried the property IsDroppingAllowed (I used it like IsExpanded and IsSelected). Unfortunatly the getter is never called.
Than I tried "OnDragOver"
DragDropManager.AddDragOverHandler(this.FolderRadTreeView, new Telerik.Windows.DragDrop.DragEventHandler(OnDragOver), true);
options.DropAction = DropAction.Move;
or
options.DropAction = DropAction.None;
and everything works fine. But after a while it drives me crazy. Is there anywhere a good example? Is there anywhere a checklist what I have to reimplement?
I tried to use the DropTargetItem to check if the dropping is allowed.
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key)
as
TreeViewDragDropOptions;
var dropItem = options.DropTargetItem.Item;
(dropItem
as
IFolderItem).IsDroppable(options.DraggedItems));
If I drop inside everthing is fine. If I drop before (Telerik.Windows.Controls.DropPosition.
Before) it seems that my dropItem I used for IsDroppable() is not the container where the RadTreeView drops my item.
An other trapdoor it that I have to check that I do not drag an Item in itself (drag A and drop it in A or drop in a child of A).
Hi team,
I am using custom Connectors and Connections along with MVVM. Per the thread, I can add some custom connection points in the overridden method GetConnectionContainerForItemOverride,
protected
override
IConnection GetConnectionContainerForItemOverride(
object
item)
{
if
(item
is
Link)
{
...
return a custom connection object;
}
return
null
;
}
Meanwhile I want to attach the connection to my custom connectors inside this method. However, at this time, the connectors of the shape still are the 5 default connectors. Are there any means to control the sequence of the overwritten methods? Or I should overwrite another virtual method?
Thanks,
Jingfei
There is a bug in RadListBox when using GroupStyle. When I select any an item from second group, radlistbox scrolls to first item in second group. This makes double click on an items almost imposible.
I wrote a simple sample demonstrating the behaviour with comparison to regular listbox
<
Window
x:Class
=
"RadControlsWpfApp2.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:RadControlsWpfApp2"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.DataContext
>
<
local:MainWindowVM
/>
</
Window.DataContext
>
<
Grid
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ListBox
x:Name
=
"listbox"
ItemsSource
=
"{Binding CollectionView}"
IsSynchronizedWithCurrentItem
=
"False"
DisplayMemberPath
=
"Name"
FontSize
=
"20"
MinWidth
=
"150"
>
<
ListBox.GroupStyle
>
<
GroupStyle
/>
</
ListBox.GroupStyle
>
</
ListBox
>
<
telerik:RadListBox
x:Name
=
"radlistbox"
ItemsSource
=
"{Binding CollectionView}"
DisplayMemberPath
=
"Name"
FontSize
=
"20"
MinWidth
=
"150"
Margin
=
"20,0,0,0"
>
<
telerik:RadListBox.GroupStyle
>
<
GroupStyle
/>
</
telerik:RadListBox.GroupStyle
>
</
telerik:RadListBox
>
</
StackPanel
>
</
Grid
>
</
Window
>
using
System.Collections.Generic;
using
System.Windows.Data;
namespace
RadControlsWpfApp2
{
public
class
MainWindowVM
{
public
List<ItemVM> Collection {
get
;
set
; }
public
ListCollectionView CollectionView {
get
;
set
; }
public
MainWindowVM()
{
Collection =
new
List<ItemVM>
{
new
ItemVM { Group =
"A"
, Name =
"Item 1"
},
new
ItemVM { Group =
"A"
, Name =
"Item 2"
},
new
ItemVM { Group =
"A"
, Name =
"Item 3"
},
new
ItemVM { Group =
"A"
, Name =
"Item 4"
},
new
ItemVM { Group =
"A"
, Name =
"Item 5"
},
new
ItemVM { Group =
"A"
, Name =
"Item 6"
},
new
ItemVM { Group =
"B"
, Name =
"Item 1"
},
new
ItemVM { Group =
"B"
, Name =
"Item 2"
},
new
ItemVM { Group =
"B"
, Name =
"Item 3"
},
new
ItemVM { Group =
"B"
, Name =
"Click Here!"
},
new
ItemVM { Group =
"B"
, Name =
"Item 5"
},
new
ItemVM { Group =
"B"
, Name =
"Item 6"
},
};
var view =
new
ListCollectionView(Collection);
view.GroupDescriptions.Add(
new
PropertyGroupDescription(
"Group"
));
CollectionView = view;
}
}
public
class
ItemVM
{
public
string
Group {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
}
Hello,
I have a custom control which inherits from usercontrol. My control is the itemtemplate of a radtreeview.
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding MyList}">
<MyControls:MyTreeNode AllowDrop="{Binding IsDropAllowed}"/>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
I want to
bind the AllowDrop Property from my control (MyTreeNode). When AllowDrop is
false, it should not possible to
drop other nodes on this node. But this doesn’t work. The radtreeview ignores the allocation. Is there any way that my
control has the same behavior likes a radtreeviewitem, when the IsDropAllowed
Property is false.
With best regards,
Sico
Hi, I want the time bar to show hours in European format (e.g 23 and not 11 PM).
The only way I found to achieve this is to set the global Telerik.Windows.Controls.LocalizationManager.DefaultCulture.
Hi,
I've noticed when adding plot points that they're not being placed accurately? The data point in the attached image should be plotted at 0,0 so the lines should intersect the circular data point evenly. However it plots it off centre.
Do I have a setting wrong or something?
Thanks,
In my project, I have a timeline that is updated every second or so.
At each second, an Item with a duration representing the elapsed time is updated : its duration is modified.
When only the duration of one item changes, the timeline is redrawn when the VisibleStartDate and/or VisibleEndDate are changed.
If the visible zone is not changed, the only way to make the new duration of the item appear on the timeline is to use the Setter on ItemsSource. But this results in poor performances, most notably because I have implemented a mechanism that remembers the selected items when the Data is refreshed (it reselects it).
So in order to only redraw the timeline without having to update the ItemSource, I resolved to this uglyhack (that works, though).
In the view model.
public void UpdateItemDurationAndRefresh()
{
itemWithDuration.Duration = GetNewTimeSpan();
this.VisibleDate = this.VisibleDate.AddMilliseconds(-1);
this.VisibleDate = this.VisibleDate.AddMilliseconds(1);
}
I tried the following, but the duration of the item is not visible until some other interactions either changes the visible zone, or the ItemSource is actually updated.
public void UpdateItemDurationAndRefresh() // DOES NOT WORK
{
itemWithDuration.Duration = GetNewTimeSpan();
this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("Data"));
// "Data" is the name of the collection containing "itemWithDuration",
// and is binded to the GUI thanks to the XAML code
}
Is there anyway to redraw the timeline without having to reset the ItemSource, just like what is done when the visible zone is modified ?
Thanks
hello guys,
i'm testing this control for developing a gantt for ms dynamics nav. Everything works fine but now i'm searching for a way to manually update the whole view, because i load data async nothing is shown in my gantt when it's loaded on my page. I want the control to completely update it's view when dataload is finished and i don't know which function to use or how to do this.
As u can see in pic1 page is open no data is shown.
As u can see in pic2 i only resize width a little bit, ganttPart is updated.
As u can see in pic3 i resize width an height more, gridPart is also updated.
i need a function to do the update, when my dataset i loaded.