Telerik Forums
UI for WPF Forum
7 answers
187 views
Hello,

I'm having trouble with the RadDragAndDropManager when the UserControl that is using it is being hosted inside of a Windows Form. I made a quick example.

<UserControl x:Class="DragAndDropTest.simple" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:dragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
    <UserControl.Resources> 
        <Style TargetType="StackPanel"
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" /> 
        </Style> 
        <Style TargetType="Label"
            <Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" /> 
        </Style> 
    </UserControl.Resources> 
    <Grid> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition /> 
            <ColumnDefinition /> 
        </Grid.ColumnDefinitions> 
        <StackPanel 
            Name="Stack1" 
            Grid.Column="0"
            <Label Name="lbl1" Background="Green" /> 
        </StackPanel> 
        <StackPanel  
            Name="Stack2" 
            Grid.Column="1"
            <Label Name="lbl2" Background="Red" /> 
        </StackPanel> 
    </Grid> 
</UserControl> 
 


using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Navigation; 
using System.Windows.Shapes; 
using Telerik.Windows.Controls.DragDrop; 
 
namespace DragAndDropTest 
    /// <summary> 
    /// Interaction logic for simple.xaml 
    /// </summary> 
    public partial class simple : UserControl 
    { 
        public simple() 
        { 
            InitializeComponent(); 
 
            RadDragAndDropManager.AddDragInfoHandler(lbl1, OnDragInfo); 
            RadDragAndDropManager.AddDragQueryHandler(lbl1, OnDragQuery); 
 
            RadDragAndDropManager.AddDragInfoHandler(lbl2, OnDragInfo); 
            RadDragAndDropManager.AddDragQueryHandler(lbl2, OnDragQuery); 
 
            RadDragAndDropManager.AddDropInfoHandler(Stack1, OnDropInfo); 
            RadDragAndDropManager.AddDropQueryHandler(Stack1, OnDropQuery); 
 
            RadDragAndDropManager.AddDropInfoHandler(Stack2, OnDropInfo); 
            RadDragAndDropManager.AddDropQueryHandler(Stack2, OnDropQuery); 
        } 
 
        private void OnDropQuery(object sender, DragDropQueryEventArgs e) 
        { 
            e.QueryResult = true
            e.Handled = true
        } 
 
        private void OnDropInfo(object sender, DragDropEventArgs e) 
        { 
            if (e.Options.Status == DragStatus.DropComplete) 
            { 
                ((e.Options.Source as Label).Parent as StackPanel).Children.Remove(e.Options.Source); 
                (sender as StackPanel).Children.Add(e.Options.Source); 
            } 
        } 
 
        private void OnDragInfo(object sender, DragDropEventArgs e) 
        { 
            Label item = sender as Label; 
            if (e.Options.Status == DragStatus.DragInProgress) 
            { 
                    ContentControl cue = new ContentControl(); 
                    cue.Content = new Label() { Background = item.Background }; 
 
                    e.Options.DragCue = cue; 
                    e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue(); 
            } 
        } 
 
        private void OnDragQuery(object sender, DragDropQueryEventArgs e) 
        { 
            e.Options.Payload = sender; 
            e.QueryResult = true
            e.Handled = true
        } 
    } 
 


using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
 
namespace DragAndDropTest  
    public partial class Form1 : Form 
    { 
        public Form1() 
        { 
            InitializeComponent(); 
            elementHost1.Child = new simple(); 
        } 
    } 

seems to work fine inside of a wpf Window but not a Form.
Any ideas on what I'm doing wrong?

Thanks much,
~Boots
Miroslav
Telerik team
 answered on 27 Jul 2010
1 answer
239 views
Im Using a showDialog(); for show my Window and i want to show it in a taskbar

can help ?
Konstantina
Telerik team
 answered on 27 Jul 2010
1 answer
278 views
I Run a Rad window , I want to show it in a Task Bar Can Do it
 
Konstantina
Telerik team
 answered on 27 Jul 2010
3 answers
168 views

Hello,

in the ChartControl-Help I found this hint to increase charting performace:

Simplify the chart item ControlTemplate - e.g. the Line item template contains by default an item label and a point mark visual. The point mark visual can be removed (as they are relatively insignificant when rendering thousands of records). With lots of points the sheer number of UI elements simply bogs the system down as discussed above). So if you cannot reduce the data points, you will need to simplify the chart item ControlTemplate.

Can anybody give me an example how to do this?

Lauren
Top achievements
Rank 1
 answered on 26 Jul 2010
1 answer
80 views
Hi,
Iam unable to find the way to put Shortcut keys for rad application menu items,like we are implementing for radmenu.
tell me the solution for this asap.
Thanks in advance.
Valentin.Stoychev
Telerik team
 answered on 26 Jul 2010
7 answers
311 views
Could someone please post a link to the latest example of Grid to Grid drag drop.  I've searched and downloaded what seems to be 3 different versions none of which I can get to work.   I'm attempting to get sample running on Microsoft Visual C# 2010 and .net4.   Any help is GREATLY appreciated.

Tina Stancheva
Telerik team
 answered on 26 Jul 2010
1 answer
163 views
Hi,

I have a combobox in my application that has this binding on the SelectedItem

SelectedItem="{Binding Path=Food, Mode=OneWayToSource}">

The back end property is define as follows

public Food Food
{
  get { return _food; }
  set { _food = value; }
}

My problem is that the above binding will try to get the property, this is not the expected behavior for this type of binding.
Can you suggest a work around you come up with fix ?

Thank you,
Valeri Hristov
Telerik team
 answered on 26 Jul 2010
5 answers
272 views
Do you plan on publishing something like this that you did for WinForms?  Or at least release all of the code used in the demos?  I see others are asking the same thing too.

Thanks!
Kaloyan
Telerik team
 answered on 26 Jul 2010
1 answer
122 views

Hi,

Version : 2010 Q2 - 2010.2.714.35

Hi,

I have a WPF application (.net 3.5) with MVP pattern and the Microsoft Unity container.
When i add a RadDatePicker in a view, there is a drop down problem :
the calendar doesn't appear and other controls have a similar behavior : for the original ComboBox, the drop down list don't display.
Without RadDatePicker, all controls appear correctly.
(With the version 2010.1.422.35, it work.)

I don't have this problem in a classic WPF application (without MVP neither Unity).

Otherwise, in the Visual Studio out, an error occurs many time  :

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=PART_DropDownButton'. BindingExpression:Path=IsMouseOver; DataItem=null; target element is 'ButtonChrome' (Name='ButtonChrome'); target property is 'RenderMouseOver' (type 'Boolean')

I try to catch this error with a diagnostic converter (System.Diagnostics) :
<Style TargetType="{x:Type telerik:RadDatePicker}">
 <Setter Property="???" Value="{Binding Path=???, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}, diagnostics:PresentationTraceSources.TraceLevel=High}"/>
</Style>

But i don't found interesting property to watch in order to have more details.

Thanks in advance

Kaloyan
Telerik team
 answered on 26 Jul 2010
2 answers
173 views
Having a little problem when I try to apply a control template to the rad carousel, in that as soon as I put in the binding to the template, the carousel no longer displays any items.

Here is the code for the carousel:
<Border
    ClipToBounds="True"
    Grid.Column="1"
    Grid.RowSpan="4"
    Grid.ColumnSpan="2"
    Grid.Row="0"
    VerticalAlignment="Top"
    Margin="0,40,10,0"
    HorizontalAlignment="Right"
    x:Name="carFav"
    Height="70px"
    Width="500px"
    Visibility="Collapsed">
    <telerik:RadCarousel
            x:Name="Favorites"
            AutoGenerateDataPresenters="False"
            HorizontalScrollBarVisibility="Hidden"
            VerticalContentAlignment="Bottom"
            Template="{StaticResource FavouritesCarousel}">
        <telerik:RadCarousel.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF7D7D7D" Offset="0.164"/>
                <GradientStop Color="White" Offset="0.093"/>
            </LinearGradientBrush>
        </telerik:RadCarousel.Background>
        <telerik:RadCarousel.ReflectionSettings>
            <telerik:ReflectionSettings Visibility="Visible" OffsetY="3"/>
        </telerik:RadCarousel.ReflectionSettings>
    </telerik:RadCarousel>
</Border>

And the control template code:
<ControlTemplate x:Key="FavouritesCarousel" TargetType="{x:Type telerik2:RadCarousel}">
    <Grid>
        <ScrollViewer
            x:Name="CarouselContentPresenter"
            CanContentScroll="True"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            Background="Gray"
            HorizontalScrollBarVisibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik2:RadCarousel}}, Path=HorizontalScrollBarVisibility}"
            VerticalScrollBarVisibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik2:RadCarousel}}, Path=VerticalScrollBarVisibility}">
            <ItemsPresenter
                x:Name="ItemsPresenter"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"/>
        </ScrollViewer>
    </Grid>
</ControlTemplate>


Any suggestions? Thanks.
James Ludlow
Top achievements
Rank 1
 answered on 26 Jul 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?