Telerik Forums
UI for WPF Forum
6 answers
361 views
I have a ListBox and RadGridView and I'm trying to implement Drag And Drop between list items and grid rows and vice versa.
This is for testing purposes and I'm trying to test raising and capturing Drop and DragCompleted events on all RadGridView parts.
Everything works fine except drop to a Header Row of a RadGridView. Drop and DragCompleted is not raised and also DragVisual shows that you can't drop to  a Header Row of a RadGridView. I guess this is a default behavior of RadGridView and I would like to ask if there is any way or workaround how to drop to a Header Row of a RadGridView? I need this feature for a WPF application in my work.

here is my xaml

<Window x:Class="DragDropManager.MainWindow"
        Title="MainWindow" >
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <Style TargetType="ListBoxItem">
                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True"></Setter>
            </Style>
            <DataTemplate x:Key="ApplicationTemplate">
                <StackPanel Orientation="Horizontal">
                    <Image Source="{Binding IconPath}"/>
                    <TextBlock Margin="5" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                </StackPanel>
            </DataTemplate>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <ListBox x:Name="ApplicationList" ItemTemplate="{StaticResource ApplicationTemplate}" AllowDrop="True"/>
        <telerik:RadGridView Grid.Column="1" AllowDrop="True" x:Name="MyGrid">
            <telerik:RadGridView.RowStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
                </Style>
            </telerik:RadGridView.RowStyle>
        </telerik:RadGridView>
    </Grid>
</Window>

and here is my code behind

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        ApplicationList.ItemsSource = ApplicationInfo.GenerateApplicationInfos();
        MyGrid.ItemsSource = new ObservableCollection<ApplicationInfo>();
 
        Telerik.Windows.DragDrop.DragDropManager.AddDragInitializeHandler(ApplicationList, OnDragInitialize);
        Telerik.Windows.DragDrop.DragDropManager.AddDragInitializeHandler(MyGrid, OnDragInitialize);
 
        Telerik.Windows.DragDrop.DragDropManager.AddGiveFeedbackHandler(ApplicationList, OnGiveFeedback);
        Telerik.Windows.DragDrop.DragDropManager.AddGiveFeedbackHandler(MyGrid, OnGiveFeedback);
 
        Telerik.Windows.DragDrop.DragDropManager.AddDragDropCompletedHandler(ApplicationList, OnDragCompleted);
        Telerik.Windows.DragDrop.DragDropManager.AddDragDropCompletedHandler(MyGrid, OnDragCompleted2);
 
        Telerik.Windows.DragDrop.DragDropManager.AddDropHandler(ApplicationList, OnDrop);
        Telerik.Windows.DragDrop.DragDropManager.AddDropHandler(MyGrid, OnDrop2);
    }
 
    private void OnDragInitialize(object sender, DragInitializeEventArgs args)
    {
        args.AllowedEffects = DragDropEffects.All;
        var payload = DragDropPayloadManager.GeneratePayload(null);
        var data = ((FrameworkElement)args.OriginalSource).DataContext;
        payload.SetData("DragData", data);
        args.Data = payload;
        args.DragVisual = new DragVisual() { Content = data, ContentTemplate = LayoutRoot.Resources["ApplicationTemplate"] as DataTemplate };
        args.DragVisualOffset = args.RelativeStartPoint;
        args.Handled = true;
    }
 
    private void OnGiveFeedback(object sender, Telerik.Windows.DragDrop.GiveFeedbackEventArgs args)
    {
        args.SetCursor(Cursors.Arrow);
        args.Handled = true;
    }
 
    private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
    {
        var data = ((DataObject)args.Data).GetData("DragData");
        ((IList)(sender as ListBox).ItemsSource).Add(data);
    }
 
    public void OnDragCompleted(object sender, Telerik.Windows.DragDrop.DragDropCompletedEventArgs args)
    {
        var data = DragDropPayloadManager.GetDataFromObject(args.Data, "DragData");
        ((IList)(sender as ListBox).ItemsSource).Remove(data);
    }
 
    private void OnDrop2(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
    {
        var data = ((DataObject)args.Data).GetData("DragData");
        ((IList)(sender as RadGridView).ItemsSource).Add(data);
    }
 
    public void OnDragCompleted2(object sender, Telerik.Windows.DragDrop.DragDropCompletedEventArgs args)
    {
        var data = DragDropPayloadManager.GetDataFromObject(args.Data, "DragData");
        ((IList)(sender as RadGridView).ItemsSource).Remove(data);
    }
}

thanks

Michal
Top achievements
Rank 1
 answered on 11 Dec 2014
1 answer
149 views
Hi,

I want to use your Pie3D chart control in a WPF project (like here : http://www.telerik.com/help/wpf/radchart-features-chart-types-3d-charts.html)
Do you have any sample ?

I looked into WPF Controls Example without success.

Thanks
Petar Marchev
Telerik team
 answered on 11 Dec 2014
2 answers
71 views
Hi,

We have a WPF application which we are testing using CUIT.  It contains Telerik controls.

The issue is that CUIT is not able to identify the controls after undocking and re-docking some of the controls, i.e., the hierarchy that is seen before undocking and re-docking is different from that seen after undocking and re-docking.

I wanted to attach the sample application but could not do so as it exceeded 2MB.

Let me know how I can give you the sample application and also in case of more information.

Regards,
Vijay
vijay
Top achievements
Rank 1
 answered on 11 Dec 2014
1 answer
334 views
Seemingly simple question... I have a RadComboBox that I want to display the selected item without the font being bold.

The template being used:

<UserControl.Resources>
  <DataTemplate x:Key="SelectionBoxTemplate">
    <TextBlock Text="{Binding Code}" FontWeight="Regular"/>
  </DataTemplate>
</UserControl.Resources>

The radcombobox:

<telerik:RadComboBox x:Name="RegionComboBox"
                     Grid.Column="2"
                     Margin="2"
                     ClearSelectionButtonContent="Clear"
                     ClearSelectionButtonVisibility="Visible"
                     DisplayMemberPath="Code"
                     ItemsSource="{Binding Regions}"
                     SelectedValue="{Binding Region,
                                             Mode=TwoWay}"
                     SelectedValuePath="Code"
                     SelectionBoxTemplate="{StaticResource SelectionBoxTemplate}"/>

I can change the color of the displayed item, but I cannot get the font weight to be regular. It is always bold.

Thanks.
Masha
Telerik team
 answered on 10 Dec 2014
1 answer
55 views
I have a real-time data stream being visualized with a ChartDataSource in a LineSeries. Right now the previously aggregated values are being rendered properly, but the value for the "current" aggregation (the one that's being built in real-time) moves around until that aggregation interval ends. Is there any way to get the ChartDataSource to only show values from complete aggregations?
Pavel R. Pavlov
Telerik team
 answered on 10 Dec 2014
1 answer
109 views
Hello,
I need to change in SettingsPane, remove Home Tab and Text, and change the content of Style Tab.
How can I do this?
I saw to projects called CustomSettingsPane, but they are not that clear for me.

Can you help me and give me a simple project to follow?

Thank you.
Pavel R. Pavlov
Telerik team
 answered on 10 Dec 2014
3 answers
142 views
Hi,

Q3 2014 WPF RadGridView is support Cell Merge (MergedCellsDirection, GroupRenderMode='Flat')

I want to more improvements.

more detail to see attach file.
(The left column is give an impact on the next column... )

Is it possible?

or  RadControl will spport it(wanted.jpg)  in the near future version .

​
Dimitrina
Telerik team
 answered on 10 Dec 2014
3 answers
158 views
I have a TimeBar in sync with the zoom/pan of multiple ChartViews. I have code that successfully converts between the time ranges of the TimeBar and the Pan/Zoom properties of the ChartViews, and all works well until I try to sync between a TimeBar and multiple ChartViews.

The execution logic goes like this:

Change the TimeBar
TimeBar change event is fired, ChartViews are updated.
ChartView pan/zoom change events are fired. TimeBar is updated, other ChartViews are updated.
TimeBar and ChartView change events are fired. TimeBar is updated, other ChartViews are updated...
etc.

... and so the application hangs from infinite event recursion. The common approach to prevent this is using a bool as a flag to prevent further execution, but this doesn't work. It seems like the assignment of the pan/zoom properties of ChartView objects are delegated through i.e. Dispatcher.BeginInvoke, since the sub-events aren't fired in-between the times where the recursion flag is set.

My current idea is to set the flag to true and set a timer i.e. 100ms later to reset the flag to false, but I'd like to know if there's a less hacky way to do this?
Petar Marchev
Telerik team
 answered on 10 Dec 2014
1 answer
85 views
I was wondering if anyone has ever created a custom router that acts much like schematic capture programs where the connections are all at right angles.  If you look at the youtube video (link is below) starting at 4m28s you can see how this works.  How would I go about creating an orthogonal routing service like this?  What I have done so far is below, which creates two points in the middle of the connection to allow this to sort of work, but it does not handle anything complex such as going around different shapes and adding additional points when needed.  Any thoughts?

public class OrthogonalRouter : IRouter
    {
        public System.Collections.Generic.IList<Point> GetRoutePoints(IConnection connection, bool showLastLine)
        {
            List<Point> pointList = new List<Point>();
            Point start = connection.StartPoint;
            Point end = connection.EndPoint;
 
            pointList.Add(new Point(start.X + (end.X - start.X) / 2, start.Y));
            pointList.Add(new Point(start.X + (end.X - start.X) / 2, end.Y));
 
            return pointList;
        }
    }


http://youtu.be/JutQuq1vFYY?t=4m28s
Kevin
Top achievements
Rank 1
 answered on 10 Dec 2014
2 answers
160 views
Hello,

I am using a TimeLine control in which I have several groups.
I'd like to know if there is a way to get the TimelineItemGroupControl over which I am moving the mouse.
In my scenario I am selecting a row from a GridView and drag-and-drop over the TimeLine control, and depending on the group that I drop the row I need to perform some action.

The TimeLine control has the next style:

<Style TargetType="telerik:TimelineItemGroupControl">
      <Setter Property="IsExpanded" Value="True" />
      <Setter Property="Header" Value="{x:Null}"/>
</Style>


Thanks in advance,

Alberto
Amige
Top achievements
Rank 1
Veteran
 answered on 10 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?