Telerik Forums
UI for WPF Forum
5 answers
125 views
Ok So here's the deal.
 VS2010 WPF Telerik 2011 Q1

The sample code runs just fine for Drag & Drop with either mouse of touch.. ViewSonic MultiTouch Monitor and HP Slate 500.

BUT my own code works with with the mouse and not Touch.. the OnDragQuery event never fires for Touch..

Any ideas??

Thanks
Pat NH USA..

<UserControl
    xmlns:CaptureScreens_Classes="clr-namespace:CaptureScreens.Classes"
    xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
  
    x:Name="Main"
    mc:Ignorable="d"
    x:Class="CaptureScreens.MainScreen" >
    <UserControl.Resources>
        <DataTemplate
            x:Key="DragTemplate">
            <Image
                Source="{Binding IconPath}"
                Stretch="None"
                VerticalAlignment="Top" />
        </DataTemplate>
        <Style
            TargetType="{x:Type ListBoxItem}"
            x:Key="draggableItemStyle">
            <Setter
                Property="HorizontalContentAlignment"
                Value="Stretch" />
            <Setter
                Property="telerikDragDrop:RadDragAndDropManager.AllowDrag"
                Value="True" />
        </Style>
   
    </UserControl.Resources>
    <UserControl.DataContext>
        <CaptureScreens_Classes:QManagement
            x:Name="QManagementInstance" />
    </UserControl.DataContext>
    <Canvas
        x:Name="LayoutRoot"
        Height="600"
        Margin="0,5,0,0"
        Width="1024" Background="White">
        <ListBox
            x:Name="lstRxToday"
            ItemsSource="{Binding RxToday, Mode=TwoWay}"
            telerik:RadDragAndDropManager.AllowDrag="True"
            telerik:RadDragAndDropManager.AllowDrop="True"
            ItemContainerStyle="{StaticResource draggableItemStyle}"
            VerticalAlignment="Top" Canvas.Left="2" Canvas.Top="2" Width="196" />
        <ListBox
            x:Name="lstPurchased"
            ItemsSource="{Binding PurchasedRx, Mode=TwoWay}"
            telerik:RadDragAndDropManager.AllowDrag="True"
            telerik:RadDragAndDropManager.AllowDrop="True"
            ItemContainerStyle="{StaticResource draggableItemStyle}"
            Height="442" Canvas.Left="240" Canvas.Top="8" Width="194"/>
    </Canvas>
</UserControl>

Maks
Top achievements
Rank 1
 answered on 16 Aug 2017
1 answer
81 views

hello,

why I input Sin(100.5),the ExpressionEditor could not show the result?

 

Wang
Top achievements
Rank 1
 answered on 16 Aug 2017
7 answers
173 views
I'm using a radgridview, and it doesn't appear to be working as expected when holding shift for multi-column sorting.

The headers change color and the directional carrots work, but it doesn't actually appear to resort on the columns after the first selected one.  Similarly, when checking inside the gridview's Sorted event, the SortDescriptors collection only contains the original column.


Is there some sort of simple setup I need to do in order to turn on multi-column sorting?



Note:

The gridview's ItemsSource is a CollectionViewSource (though it appears the source is set to a DataView)

I'm using RadControls for WPF Q1 2011 SP1

 
Roy
Top achievements
Rank 1
 answered on 15 Aug 2017
16 answers
286 views

On the gridview we have a lot of levels but the performance on the grid is poor so i tried to switch the grouprendermode from nested to flat.

As a result all row that have no data on a deeper level aren't showing anymore.

Is this normal behaviour? because now we are missing data in the grid (the row space is reserved but data isn't showing)

Below a screenshot with nested and flat grouprendermode

Stefan
Telerik team
 answered on 15 Aug 2017
1 answer
140 views
Hello,

If this post is not relevant please delete it. I am trying to get the data type of a table while filtering. My intention is  while user click on filter option it will check whether that column has string if it has string it will show filter option as "Contains" otherwise filter will display the default i.e Is Equals To. Below are my code.

This piece of code is working fine for all tables but in one table (for all column) while i am trying this code it gives a Null reference exceptions. Any suggestion how to debug and where should i look to fix this issue?

private void OnRadGridViewFilterOperatorsLoading(object sender, Telerik.Windows.Controls.GridView.FilterOperatorsLoadingEventArgs e)
        {
            var column = e.Column as GridViewDataColumn;
            if (column.DataType.Name == "String") //this returning me null reference exceptions(but few column of this table does have string value) for one table but for rest tables i am getting value
            {
                e.DefaultOperator1 = Telerik.Windows.Data.FilterOperator.Contains;
                e.DefaultOperator2 = Telerik.Windows.Data.FilterOperator.Contains;
            }
Stefan
Telerik team
 answered on 15 Aug 2017
2 answers
261 views

I have a treeview and a gridview. The user should be able to move elements from the gridview to the treeview and change the effect of the drag&drop action by using the shift or control key (like in Windows Explorer).

In the GiveFeedback event the effect is set according to the pressed key and also the visualization shows the expected behavior. But in the Drop event (on the treeview) and in the DragDropCompleted event (on the gridview) the effect is set to All, therefore I'm not able to decide if I have to remove the Element from the current list.

Am I missing something or is there a Bug in the library?

 

XAML:

<Window x:Class="DragAndDropToTreeView.MainWindow"
        xmlns:local="clr-namespace:DragAndDropToTreeView"
        Title="MainWindow"
        Width="623"
        Height="461">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="1*" />
      <ColumnDefinition Width="2*" />
    </Grid.ColumnDefinitions>
    <telerik:RadTreeView AllowDrop="True"
                         ItemsSource="{Binding Folders}"
                         SelectedItem="{Binding SelectedFolder,
                                                Mode=TwoWay}"
                         SelectionMode="Single">
      <telerik:RadTreeView.Resources>
        <HierarchicalDataTemplate DataType="{x:Type local:Folder}" ItemsSource="{Binding Children}">
          <Grid VerticalAlignment="Center">
            <TextBlock VerticalAlignment="Center"
                       Text="{Binding Name}"
                       local:TreeItemDropBehavior.IsEnabled="True" />
          </Grid>
        </HierarchicalDataTemplate>
      </telerik:RadTreeView.Resources>
    </telerik:RadTreeView>
    <telerik:RadGridView Grid.Column="1"
                         AllowDrop="True"
                         AutoGenerateColumns="False"
                         CanUserFreezeColumns="False"
                         CanUserReorderColumns="False"
                         CanUserResizeColumns="False"
                         FontSize="12"
                         IsFilteringAllowed="False"
                         IsReadOnly="True"
                         ItemsSource="{Binding SelectedFolder.Elements}"
                         RowHeight="32"
                         RowIndicatorVisibility="Collapsed"
                         SelectionMode="Multiple"
                         ShowGroupPanel="False"
                         local:GridViewDragDropBehavior.IsEnabled="True"
                         telerik:DragDropManager.AllowCapturedDrag="True"
                         telerik:DragDropManager.AllowDrag="True">
      <telerik:RadGridView.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary>
              <DataTemplate x:Key="DraggedItemTemplate">
                <StackPanel Orientation="Horizontal">
                  <TextBlock Text="Dragging: " />
                  <TextBlock FontWeight="Bold" Text="{Binding CurrentDraggedItems.Count}" />
                  <TextBlock Text=" Element(s)" />
                </StackPanel>
              </DataTemplate>
            </ResourceDictionary>
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
      </telerik:RadGridView.Resources>
      <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Width="100"
                                    DataMemberBinding="{Binding Name}"
                                    Header="Name" />
        <telerik:GridViewDataColumn Width="250"
                                    DataMemberBinding="{Binding Description}"
                                    Header="Description" />
      </telerik:RadGridView.Columns>
    </telerik:RadGridView>
  </Grid>
</Window>

 

GridViewDragDropBehavior.cs:

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
 
using Telerik.Windows.Controls;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
 
using GiveFeedbackEventArgs = Telerik.Windows.DragDrop.GiveFeedbackEventArgs;
 
namespace DragAndDropToTreeView
{
  public class GridViewDragDropBehavior
  {
    public RadGridView AssociatedControl { get; set; }
 
    private static readonly Dictionary<RadGridView, GridViewDragDropBehavior> Instances;
 
    static GridViewDragDropBehavior()
    {
      Instances = new Dictionary<RadGridView, GridViewDragDropBehavior>();
    }
 
    public static bool GetIsEnabled(DependencyObject obj)
    {
      return (bool)obj.GetValue(IsEnabledProperty);
    }
 
    public static void SetIsEnabled(DependencyObject obj, bool value)
    {
      GridViewDragDropBehavior behavior = GetAttachedBehavior(obj as RadGridView);
 
      behavior.AssociatedControl = obj as RadGridView;
 
      if (value)
      {
        behavior.Initialize();
      }
      else
      {
        behavior.CleanUp();
      }
 
      obj.SetValue(IsEnabledProperty, value);
    }
 
    public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached(
      "IsEnabled",
      typeof(bool),
      typeof(GridViewDragDropBehavior),
      new PropertyMetadata(OnIsEnabledPropertyChanged));
 
    public static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
    {
      SetIsEnabled(dependencyObject, (bool)e.NewValue);
    }
 
    private static GridViewDragDropBehavior GetAttachedBehavior(RadGridView gridView)
    {
      if (!Instances.ContainsKey(gridView))
      {
        Instances[gridView] = new GridViewDragDropBehavior { AssociatedControl = gridView };
      }
 
      return Instances[gridView];
    }
 
    protected virtual void Initialize()
    {
      UnsubscribeFromDragDropEvents();
      SubscribeToDragDropEvents();
    }
 
    protected virtual void CleanUp()
    {
      UnsubscribeFromDragDropEvents();
    }
 
    private void SubscribeToDragDropEvents()
    {
      DragDropManager.AddDragInitializeHandler(AssociatedControl, OnDragInitialize);
      DragDropManager.AddGiveFeedbackHandler(AssociatedControl, OnGiveFeedback);
      DragDropManager.AddDragDropCompletedHandler(AssociatedControl, OnDragDropCompleted);
      DragDropManager.AddDragOverHandler(AssociatedControl, OnDragOver);
    }
 
    private void UnsubscribeFromDragDropEvents()
    {
      DragDropManager.RemoveDragInitializeHandler(AssociatedControl, OnDragInitialize);
      DragDropManager.RemoveGiveFeedbackHandler(AssociatedControl, OnGiveFeedback);
      DragDropManager.RemoveDragDropCompletedHandler(AssociatedControl, OnDragDropCompleted);
      DragDropManager.RemoveDragOverHandler(AssociatedControl, OnDragOver);
    }
 
    private void OnDragInitialize(object sender, DragInitializeEventArgs e)
    {
      DropIndicationDetails details = new DropIndicationDetails();
      var gridView = sender as RadGridView;
      details.DragSource = gridView.ItemsSource;
 
      var items = gridView.SelectedItems;
      details.CurrentDraggedItems = items;
 
      IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);
 
      dragPayload.SetData("DraggedData", items);
      dragPayload.SetData("DropDetails", details);
 
      e.Data = dragPayload;
 
      e.DragVisual = new DragVisual { Content = details, ContentTemplate = AssociatedControl.Resources["DraggedItemTemplate"] as DataTemplate };
      e.DragVisualOffset = new Point(e.RelativeStartPoint.X + 10, e.RelativeStartPoint.Y);
      e.AllowedEffects = DragDropEffects.All;
    }
 
    private void OnGiveFeedback(object sender, GiveFeedbackEventArgs e)
    {
      Debug.WriteLine("GridViewDragDropBehavior.OnGiveFeedback {0}", e.Effects);
      e.SetCursor(Cursors.Arrow);
      e.Handled = true;
    }
 
    private void OnDragDropCompleted(object sender, DragDropCompletedEventArgs e)
    {
      Debug.WriteLine("GridViewDragDropBehavior.OnDragDropCompleted: {0}", e.Effects);
      var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData") as IList;
      var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails");
      Debug.WriteLine(e.Effects);
 
      // Remove Element from source list if drag drop effect is move
      /*if (e.Effects == DragDropEffects.Move)
      {
        var collection = (details as DropIndicationDetails).DragSource as IList;
        foreach(var element in data)
        {
          collection.Remove(element);
        }
      }*/
    }
 
    private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
    {
      Debug.WriteLine("GridViewDragDropBehavior.OnDragOver: {0}", e.Effects);
      e.Effects = DragDropEffects.None;
      e.Handled = true;
    }
  }
}

 

TreeItemDropBehavior.cs:

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using Telerik.Windows.Controls;
using Telerik.Windows.DragDrop;
 
namespace DragAndDropToTreeView
{
  public class TreeItemDropBehavior
  {
    /// <summary>
    /// AssociatedObject Property
    /// </summary>
    public RadTreeViewItem AssociatedObject { get; set; }
 
    private static readonly Dictionary<RadTreeViewItem, TreeItemDropBehavior> Instances;
 
    static TreeItemDropBehavior()
    {
      Instances = new Dictionary<RadTreeViewItem, TreeItemDropBehavior>();
    }
 
    public static bool GetIsEnabled(DependencyObject obj)
    {
      return (bool)obj.GetValue(IsEnabledProperty);
    }
 
    public static void SetIsEnabled(DependencyObject obj, bool value)
    {
      var treeViewItem = obj.ParentOfType<RadTreeViewItem>();
      TreeItemDropBehavior behavior = GetAttachedBehavior(treeViewItem);
 
      behavior.AssociatedObject = treeViewItem;
 
      if (value)
      {
        behavior.Initialize();
      }
      else
      {
        behavior.CleanUp();
      }
 
      obj.SetValue(IsEnabledProperty, value);
    }
 
    // Using a DependencyProperty as the backing store for IsEnabled. This enables animation, styling, binding, etc...
    public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached(
      "IsEnabled",
      typeof(bool),
      typeof(TreeItemDropBehavior),
      new PropertyMetadata(OnIsEnabledPropertyChanged));
 
    public static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
    {
      SetIsEnabled(dependencyObject, (bool)e.NewValue);
    }
 
    private static TreeItemDropBehavior GetAttachedBehavior(RadTreeViewItem treeViewItem)
    {
      if (!Instances.ContainsKey(treeViewItem))
      {
        Instances[treeViewItem] = new TreeItemDropBehavior { AssociatedObject = treeViewItem };
      }
 
      return Instances[treeViewItem];
    }
 
    protected virtual void Initialize()
    {
      DragDropManager.AddGiveFeedbackHandler(AssociatedObject, OnGiveFeedback);
      DragDropManager.AddDropHandler(AssociatedObject, OnDrop);
    }
 
    protected virtual void CleanUp()
    {
      DragDropManager.RemoveGiveFeedbackHandler(AssociatedObject, OnGiveFeedback);
      DragDropManager.RemoveDropHandler(AssociatedObject, OnDrop);
    }
 
    private void OnGiveFeedback(object sender, Telerik.Windows.DragDrop.GiveFeedbackEventArgs e)
    {
      Debug.WriteLine("TreeItemDropBehavior.OnGiveFeedback {0}", e.Effects);
      e.SetCursor(Cursors.Arrow);
      e.Handled = true;
    }
 
    private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
    {
      Debug.WriteLine("TreeItemDropBehavior.OnDrop: {0}", e.Effects);
 
      if (e.Effects != DragDropEffects.None)
      {
        var destinationItem = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
        var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData") as IList;
        var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
 
        if (destinationItem != null)
        {
          foreach (var element in data)
          {
            (destinationItem.DataContext as Folder).Elements.Add(element as Element);
          }
 
          e.Handled = true;
        }
      }
    }
  }
}
Martin Ivanov
Telerik team
 answered on 15 Aug 2017
5 answers
229 views

I thought I would try using the new Material theme with a new WPF project.

All good but for some reason there is no filtering available in the RadGridViews in my project.

As soon as I change to one of the older themes the filtering comes back, When I change back to Material Theme it disappears.

Any help greatly appreciated.

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 15 Aug 2017
5 answers
110 views

Hi @ all,

we are thinking to create a small Barcode-Designer with telerik wpf Controls. Conditions:

- Creating Layouts in different dimensions.
- Load Layout out of (txt) File and
- Add Fields like text, Real/Integer, Images, Barcodes
- Save the Layout in a file (.txt?) like:
- Print a Testfile in pdf.

Second Programm running on a windows client

Which controls are usefull? Is it possible to do with telerik wpf controls?
Any Ideas?

Thanks a lot

Best Regards
RENE

Dilyan Traykov
Telerik team
 answered on 11 Aug 2017
1 answer
180 views

Hi,

I would like to know, if it is possible to fit to a type of "box"-Coordinates inside the PDF-Files

I would like to open a pdf and then define the "View" to display.

Could be 4 Points (Left upper/Right upper/Right lower/Left lower) or (Left upper + Width/Height) or something similiar.

Then the PDF-Viewer should scroll to the left upper point and zoom to have the "box" displayed.

Is this possible?

Thanks

Juergen

Peshito
Telerik team
 answered on 11 Aug 2017
1 answer
1.4K+ views
I want to create a Search box. I have uploaded a file for reference. Thanks in advance!
Dinko | Tech Support Engineer
Telerik team
 answered on 11 Aug 2017
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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?