Hello,
i have a simple childWindow with a treeview and want to have the hability to drag/drop element in.
But my code who work fine in a main page, doesn't work on ChildWindow, have you an idea ?
Here my xaml :
And in my c# :
The childwindow is loaded in front of a gridview which support drag/drop manually, maybe the problem ?
Any idea ?
I use the last version of silverlight telerik.
Thank you :).
i have a simple childWindow with a treeview and want to have the hability to drag/drop element in.
But my code who work fine in a main page, doesn't work on ChildWindow, have you an idea ?
Here my xaml :
<basics:ChildWindow.Resources> |
<telerik:ContainerBindingCollection x:Name="Collection"> |
<telerik:ContainerBinding PropertyName="DisplayName" Binding="{Binding DisplayName, Mode=TwoWay}" /> |
</telerik:ContainerBindingCollection> |
<telerik:HierarchicalDataTemplate x:Key="CategoryTemplate" |
ItemsSource="{Binding ChildProducts}" |
telerik:ContainerBinding.ContainerBindings="{StaticResource Collection}"> |
<TextBlock Text="{Binding DisplayName}" Foreground="Black" /> |
</telerik:HierarchicalDataTemplate> |
</basics:ChildWindow.Resources> |
<Grid x:Name="LayoutRoot" Background="White"> |
<StackPanel Margin="0,0,0,28" HorizontalAlignment="Left"> |
<TextBlock Height="24" Margin="0,0,0,0" TextWrapping="Wrap" FontWeight="Bold"><Run Text="Glisser les éléments les uns en dessous des autres pour les ordonner"/></TextBlock> |
<telerikNavigation:RadTreeView x:Name="ReorderList" |
IsDragPreviewEnabled="True" |
ItemTemplate="{StaticResource CategoryTemplate}" |
IsDragTooltipEnabled="true" |
IsDropPreviewLineEnabled="false" |
IsDragDropEnabled="True" IsEditable="true" |
IsTextSearchEnabled="true" Language="fr" IsVirtualizing="true" |
SelectionMode="Multiple" MaxHeight="400"> |
<telerikNavigation:RadTreeView.ItemEditTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<TextBox Text="{Binding DisplayName, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" /> |
</StackPanel> |
</DataTemplate> |
</telerikNavigation:RadTreeView.ItemEditTemplate> |
</telerikNavigation:RadTreeView> |
</StackPanel> |
<StackPanel Margin="0,0,1,0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right"> |
<Button x:Name="CancelButton" Content="Annuler les modifications" Click="CancelButton_Click" Width="154" Height="23" HorizontalAlignment="Right" /> |
<Button x:Name="OKButton" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Content="Enregistrer" Margin="54,0,0,0" /> |
</StackPanel> |
</Grid> |
And in my c# :
public partial class ReorderElements : ChildWindow |
{ |
public ObservableCollection<ListingProduct> ProductList { get; set; } |
public ReorderElements() |
{ |
InitializeComponent(); |
ReorderList.Loaded += new RoutedEventHandler(ReorderList_Loaded); |
ReorderList.DragEnded += new RadTreeViewDragEndedEventHandler(ReorderList_DragEnded); |
ReorderList.PreviewDragStarted += new RadTreeViewDragEventHandler(ReorderList_PreviewDragStarted); |
ReorderList.PreviewDragEnded += new RadTreeViewDragEndedEventHandler(ReorderList_PreviewDragEnded); |
RadDragAndDropManager.AddDropQueryHandler(ReorderList, OnDropInsideTreeViewDropQuery); |
} |
void ReorderList_PreviewDragStarted(object sender, RadTreeViewDragEventArgs e) |
{ |
} |
private void OnDropInsideTreeViewDropQuery(object sender, DragDropQueryEventArgs e) |
{ |
//Just a debug function (i want to have the hability to check if im on before or after dropposition and not an inside drop position But it never happen... |
Debug.WriteLine("ok"); |
} |
void ReorderList_PreviewDragEnded(object sender, RadTreeViewDragEndedEventArgs e) |
{ |
} |
void ReorderList_DragEnded(object sender, RadTreeViewDragEndedEventArgs e) |
{ |
} |
void ReorderList_Loaded(object sender, RoutedEventArgs e) |
{ |
} |
protected override void OnOpened() |
{ |
base.OnOpened(); |
ReorderList.ItemsSource = ProductList; |
} |
private void OKButton_Click(object sender, RoutedEventArgs e) |
{ |
this.DialogResult = true; |
} |
private void CancelButton_Click(object sender, RoutedEventArgs e) |
{ |
this.DialogResult = false; |
} |
} |
The childwindow is loaded in front of a gridview which support drag/drop manually, maybe the problem ?
Any idea ?
I use the last version of silverlight telerik.
Thank you :).