Telerik Forums
UI for WPF Forum
6 answers
134 views

Hi,

I have problems when drag dropping inherited appointments from RadListBox to RadScheduleView. When the inherited class ProtocolChildAppointment (as below) is dropped from radListBox to scheduleview its a ProtocolAppointment class not the intented inherited class. I have tried to override Drop-function without success. Everything looks like its dropping a ProtocolChildAppointment  in the ConvertTo, ConvertDraggedData and Drop -functions.

public class ProtocolAppointment : Appointment
{
    public ProtocolAppointment()
        : base()
    {
    }
    // code...
    public override IAppointment Copy()
    {
        var newAppointment = new ProtocolAppointment();
        newAppointment.CopyFrom(this);
        return newAppointment;
    }
}

public class ProtocolChildAppointment : ProtocolAppointment
{
    public ProtocolChildAppointment()
        : base()
    {
    }
    //code...
    public override IAppointment Copy()
    {
        var newAppointment = new ProtocolChildAppointment();
        newAppointment.CopyFrom(this);
        return newAppointment;
    }
}

class ProtocolScheduleViewDragDropBehavior : Telerik.Windows.Controls.ScheduleViewDragDropBehavior
{
    public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
    {
        if (DataObjectHelper.GetDataPresent(data, typeof(ProtocolAppointment), true))
        {
            return ((IEnumerable)DataObjectHelper.GetData(data, typeof(ProtocolAppointment), true)).OfType<IOccurrence>();
        }
        return base.ConvertDraggedData(data);
    }

    public override void Drop(Telerik.Windows.Controls.DragDropState state)
    {
        // here all stil looks like its dropping ProtocolChildAppointment
        base.Drop(state);
    }

}

class ProtocolAppointmentConverter : DataConverter
{
    public override string[] GetConvertToFormats()
    {
        return new string[] { typeof(PetErpUIClient.ProtocolAppointment).AssemblyQualifiedName };
    }

    public override object ConvertTo(object data, string format)
    {
        if (DataObjectHelper.GetDataPresent(data, typeof(ProtocolAppointment), false))
        {
            var payload = (IEnumerable)DataObjectHelper.GetData(data, typeof(ProtocolAppointment), false);
            if (payload != null)
            {
                List<PetErpUIClient.ProtocolAppointment> apps = new List<PetErpUIClient.ProtocolAppointment>();
                apps.AddRange(payload.OfType<PetErpUIClient.ProtocolAppointment>());
                return apps;
            }
        }
        return null;
    }
}

Kalin
Telerik team
 answered on 25 Jan 2016
3 answers
723 views

Hi,

I am using RadListBox with ContextMenu  for an item,

on every right click (only on an item) i need

1. that the menu will be open only on the item (when i am clicking on free space on the list area, i don't want that the menu will open)

2. get the selected item to my viewModel

 

this is my code:

<telerik:RadListBox

           ItemSource ="{Binding collection}" , SelectedItem="{Binding Selected2, mode =TwoWay}">

 <teletik:RadContextMenu.ContextMenu>

       <teletik:RadContextMenu>

          <telerik:RadMenuItem Header="This menu is only for item" command="{Binding c}" CommandParamter="{Binding=selectedItem}"/>

   </teletik:RadContextMenu.ContextMenu>
 </teletik:RadContextMenu>

 

 

 

 

shay
Top achievements
Rank 1
 answered on 24 Jan 2016
0 answers
189 views
I need Basic Memory Card Game source code WPF-C# please help me
Salih
Top achievements
Rank 1
 asked on 22 Jan 2016
1 answer
197 views
How can I add text to the timeline items
Dinko | Tech Support Engineer
Telerik team
 answered on 22 Jan 2016
2 answers
128 views
How can I filter with accent insensitive?
Alain
Top achievements
Rank 1
 answered on 22 Jan 2016
1 answer
744 views

I can't get rid of a XAML designer error.

<UserControl x:Class="MenuItemBinding.SomeUserControl"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
   <Grid>
      <telerik:RadMenu>
         <telerik:RadMenuItem Header="Hello World" Command="{Binding HelloWorld}" />
      </telerik:RadMenu>
   </Grid>
</UserControl>
 

 The 'Command="{Binding' part has a green underline with the tooltip "The property "Command" does not have an accessible setter".

Observations:

  • Only happens in x64 (x86 doesn't show this error).
  • Seems to only happen with RadMenuItem although I have not check all cases.
  • It happens regardless where I place the RadMenuItem in the XAML.
  • The application still works fine even though the XAML designer is stuck to "Invalid Markup"

How do I get rid of this error?

Nasko
Telerik team
 answered on 22 Jan 2016
5 answers
256 views

Hello,

it seems there is a problem with the localization manager for DateTimePicker, in case of a wrong date:

When the control is loaded, it asks for the text to display with the "Error" name.
When the error occurs, it is asking again for the same text, but the key now is the value returned from the first call!

Example:
1. the control asks for the text to display "Error", the application returns "Erreur" (in French).
2. in case of error, the control asks for the text to display "Erreur".

Kalin
Telerik team
 answered on 22 Jan 2016
3 answers
167 views

I am using the method of the Interface

System.Threading.Tasks.Task<object> UploadFileAsync(string fileName, Stream fileStream, CloudUploadFileProgressChanged uploadProgressChanged, CancellationToken cancellationToken)

 

Task<object> which is the reurn type contains each file uploaded but how do I get this as a list which I can then use. This file list is different from what is uploaded bcos the uploaded files have the server side url link where as client files have c:\url

 My code is as below

 

        public Task<object> UploadFileAsync(string fileName, System.IO.Stream fileStream, CloudUploadFileProgressChanged uploadProgressChanged, CancellationToken cancellationToken)
        {
            Func<object> f = () =>
            {
                lock (_object)
                {
                    FileSize = fileStream.Length;
                    
                    if (uploadProgressChanged != null)
                    {
                        UploadProgressChanged = uploadProgressChanged;

                        UploadProgressChanged(FileSize / 10);
                    }
                    if (cancellationToken != CancellationToken.None && cancellationToken.IsCancellationRequested)
                    {
                        return null;
                    }
                    HttpResponseMessage fileResult;
                    CustomFileResult customFileResult;
                    try
                    {
                        fileResult = UploadFile(fileName, fileStream, cancellationToken).Result;
                        if (fileResult.IsSuccessStatusCode)
                        {
                            var response = fileResult.Content.ReadAsStringAsync();
                            customFileResult = JsonConvert.DeserializeObject<CustomFileResult>(response.Result);

                        }
                        else
                        {
                            var message = string.Format("Status code {0}, Reason {1}", fileResult.StatusCode,
                                fileResult.ReasonPhrase);
                            throw new ApplicationException(message);
                        }
                    }
                    catch (System.Exception)
                    {
                        throw;
                    }

                    if (UploadProgressChanged != null)
                    {
                        UploadProgressChanged(FileSize);
                    }

                    return customFileResult;
                }
            };

            fileStream.Position = 0;
            return Task.Factory.StartNew(f, cancellationToken);
        }

 

    public class CustomFileResult
    {
        public IEnumerable<string> FileNames { get; set; }
        public string Description { get; set; }
        public DateTime CreatedTimestamp { get; set; }
        public DateTime UpdatedTimestamp { get; set; }
        public string DownloadLink { get; set; }
        public IEnumerable<string> ContentTypes { get; set; }
        public IEnumerable<string> Names { get; set; }
        public IEnumerable<string> Sizes { get; set; }
    }

 

Can you provide an example where I can get hold of the result of the upload and populate the client side with the server images which are uploaded which in my case is the CustomFileResult and the property is DownloadLink.

Petar Marchev
Telerik team
 answered on 22 Jan 2016
3 answers
283 views

Hi,

We're using Visual Studio 2012 Update 5 and Telerik UI for WPF 2015.3.1104.45 version.

We have develop a custom gridview with the functionality of two wpf examples from your WPF controls examples. (GridView Control Panel and PersistenceFramework GridView Serialization) and somtimes we're getting this exception when we drag and drop a column to group field area.

Error: Object reference not set to an instance of an object.
Stacktrace:
   bei Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
   bei Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency()
   bei Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh(CurrencyRefreshInfo currencyRefreshInfo)
   bei Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
   bei Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
   bei Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
   bei Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh()
   bei Telerik.Windows.Data.QueryableCollectionView.OnGroupDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   bei System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   bei System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   bei Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
   bei System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
   bei System.Collections.ObjectModel.Collection`1.System.Collections.IList.Insert(Int32 index, Object value)
   bei Telerik.Windows.Data.CollectionHelper.Insert(IList target, IEnumerable newItems, Int32 startingIndex, IEqualityComparer itemComparer)
   bei Telerik.Windows.Data.ObservableCollectionManager.HandleCollectionChanged(IList sender, NotifyCollectionChangedEventArgs args)
   bei Telerik.Windows.Data.ObservableCollectionManager.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
   bei Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
   bei System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   bei System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   bei Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)
   bei System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
   bei Telerik.Windows.Controls.GridView.GridViewDataControl.PerformGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
   bei Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass6c.<RequestGrouping>b__6b()
   bei Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   bei Telerik.Windows.Controls.GridView.GridViewDataControl.RequestGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
   bei Telerik.Windows.Controls.GridView.DragDropController.OnGroupPanelDrop(Object sender, DragEventArgs e)
   bei Telerik.Windows.DragDrop.DragEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   bei Telerik.Windows.DragDrop.IInputElementExtensions.RaiseEvent(DependencyObject d, RoutedEventArgs routedEventArgs)
   bei Telerik.Windows.DragDrop.DragDropManager.DelegateHelper.OnDragEventHandler(Object sender, DragEventArgs e)
   bei Telerik.Windows.DragDrop.DragDropManager.DelegateHelper.OnDrop(Object sender, DragEventArgs e)
   bei System.Windows.DragEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   bei System.Windows.OleDropTarget.RaiseDragEvent(RoutedEvent dragEvent, Int32 dragDropKeyStates, Int32& effects, DependencyObject target, Point targetPoint)
   bei System.Windows.OleDropTarget.MS.Win32.UnsafeNativeMethods.IOleDropTarget.OleDrop(Object data, Int32 dragDropKeyStates, Int64 point, Int32& effects)
   bei MS.Win32.UnsafeNativeMethods.DoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
   bei System.Windows.OleServicesContext.OleDoDragDrop(IDataObject dataObject, IOleDropSource dropSource, Int32 allowedEffects, Int32[] finalEffect)
   bei System.Windows.DragDrop.OleDoDragDrop(DependencyObject dragSource, DataObject dataObject, DragDropEffects allowedEffects)
   bei System.Windows.DragDrop.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects)
   bei Telerik.Windows.DragDrop.DragDropManager.DoDragDrop(DependencyObject dragSource, Object data, DragDropEffects allowedEffects, DragDropKeyStates initialKeyState, Object dragVisual, Point relativeStartPoint, Point dragVisualOffset)
   bei Telerik.Windows.DragDrop.DragInitializer.StartDrag()
   bei Telerik.Windows.DragDrop.DragInitializer.StartDragPrivate(UIElement sender)
   bei Telerik.Windows.DragDrop.DragInitializer.DragSourceOnMouseMove(Object sender, MouseEventArgs e)
   bei System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   bei System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   bei System.Windows.Input.InputManager.ProcessStagingArea()
   bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   bei System.Windows.Application.RunDispatcher(Object ignore)
   bei System.Windows.Application.RunInternal(Window window)
   bei System.Windows.Application.Run(Window window)
   bei System.Windows.Application.Run()
   bei MetaxLvs.App.Main() in c:\Users\M5300\Documents\Visual Studio 2012\Projects\Metax\Metax-ERP\Metax-LVS\obj\x86\Debug\App.g.cs:Zeile 0.

Stefan
Telerik team
 answered on 21 Jan 2016
2 answers
133 views
Is there a way to make the KeyTipService work for the items in a listbox on a RadRibbonDropDownButton?
Martin Ivanov
Telerik team
 answered on 21 Jan 2016
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
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?