This is a migrated thread and some comments may be shown as answers.

Drop onto Page/User Control

1 Answer 48 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
xav
Top achievements
Rank 1
xav asked on 24 Jun 2010, 12:47 AM
I'm actually starting with your Window | First Look demo. What I want to do is this. I have list box at the top of my page. When I drag from the list box to the containing page (User Control) I want to programatically create a RadWindow based on the text of the Listbox.

is this possible?  This is the XAML I'm starting with:

<UserControl x:Class="CODYRecords.MainPage3" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:dragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"               
    mc:Ignorable="d" 
    d:DesignHeight="609" d:DesignWidth="1053" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">  
    <UserControl.Resources> 
        <Style TargetType="ListBoxItem" x:Key="draggableListBoxItem">  
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" /> 
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" /> 
        </Style> 
        <Style TargetType="ListBox" x:Key="draggableListBox">  
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" /> 
            <Setter Property="ItemContainerStyle" Value="{StaticResource draggableListBoxItem}" /> 
        </Style> 
    </UserControl.Resources> 
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">  
        <Grid.RowDefinitions> 
            <RowDefinition Height="24*" /> 
            <RowDefinition Height="585*" /> 
        </Grid.RowDefinitions> 
 
        <telerik:RadExpander x:Name="radExpander" ExpandDirection="Down" VerticalAlignment="Top" 
                    HorizontalAlignment="Stretch" Collapsed="radExpander_Collapsed">  
            <telerik:RadExpander.Header> 
                <TextBlock x:Name="expanderCaption" Foreground="#FFFFFFFF" Text="RadExpander" 
                            Visibility="Visible" /> 
            </telerik:RadExpander.Header> 
            <telerik:RadExpander.Content> 
 
                <ListBox Name="listBox1"  Style="{StaticResource draggableListBox}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  /> 
            </telerik:RadExpander.Content> 
        </telerik:RadExpander> 
    </Grid> 
</UserControl> 
 

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 29 Jun 2010, 02:17 PM
Hi xav,

I prepared a sample project for you illustrating how to drag a ListBoxItem and when it's dropped onto a Grid, RadWindow is created and displayed. The RadWindow header is set to the ListBoxItem's Content.

Please take a look at it and let me know if this is what you had in mind.

Greetings,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DragAndDrop
Asked by
xav
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or