Telerik Forums
UI for WPF Forum
2 answers
325 views
Hi,

I'm version 2012.3.1017.40 and trying to enabled the TrackBar Behavior on a double-click on the chart's data area and then disable it with another double click.  I keep getting an exception when I try to disable it.  I'm wondering if this is a bug with the control, or is it the way I'm trying to disable it?

Here is how I'm trying to Enable/Disable the TrackBall behavior:
 
private void radCartesianChart1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {      
  
      int index = -1;
  
      for (int i = 0; i < radCartesianChart1.Behaviors.Count; i++)
      {
        if (radCartesianChart1.Behaviors[i] is ChartTrackBallBehavior)
        {
          index = i;
          break;
        }
      }
  
      var mousePosition = e.GetPosition(this);
      Telerik.Charting.DataTuple tuple = radCartesianChart1.ConvertPointToData(mousePosition);
  
      //make sure the double-click occurred in the chart data area
      if (Convert.ToSingle(tuple.FirstlValue) > 0 && Convert.ToSingle(tuple.SecondValue) > 0)
      {
        if (_ShowTrackBall == false)
        {
          //create the TrackBallBehavior and add
          if (index == -1)
          {
            ChartTrackBallBehavior tb = new ChartTrackBallBehavior();
            tb.ShowIntersectionPoints = true;
            tb.ShowTrackInfo = true;
            radCartesianChart1.Behaviors.Add(tb);
  
            _ShowTrackBall = true;
          }
        }
        else
        {
          if (index != -1)
          {
            ChartTrackBallBehavior tb = radCartesianChart1.Behaviors[index] as ChartTrackBallBehavior;
            radCartesianChart1.Behaviors.Remove(tb);
  
            _ShowTrackBall = false;
          }
        
      }  
    }

It throws an System.ArgumentNullException, {"Value cannot be null.\r\nParameter name: key"},  when I try to disable it with the following StackTrace:
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.GetPresenterToDataPointInfos(List`1 dataPointInfos) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 697
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.FilterDataPointsByClosestCategoryPerAxis(List`1 dataPointInfos) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 674
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.UpdateDataContext(ChartDataContext context) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 371
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.UpdateVisuals() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 345
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.OnMouseMove() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 570
   at Telerik.Windows.Controls.ChartView.ChartTrackBallBehavior.AdornerContainerMouseMove(Object sender, MouseEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartTrackBallBehavior.Branch.cs:line 588
   at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.MouseDevice.Synchronize()
   at System.Windows.Input.MouseDevice.ChangeMouseCapture(IInputElement mouseCapture, IMouseInputProvider providerCapture, CaptureMode captureMode, Int32 timestamp)
   at System.Windows.Input.MouseDevice.Capture(IInputElement element, CaptureMode captureMode)
   at System.Windows.UIElement.CaptureMouse()
   at Telerik.Windows.Controls.ChartView.ChartPanAndZoomBehavior.AdornerContainerMouseLeftButtonDown(Object sender, MouseButtonEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartPanAndZoomBehavior.Branch.cs:line 256
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at delete_TelerikGridViewTest.App.Main() in C:\Users\dkepple\documents\visual studio 2010\Projects\delete_TelerikGridViewTest\delete_TelerikGridViewTest\obj\x86\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

dd

Thanks,
David
David
Top achievements
Rank 1
 answered on 26 Oct 2012
1 answer
135 views
Please find the sample project here

The sample application is divided into two parts:

The bottom part is similar to the RadListBox drag-n-drop demo with 4 elements:
  1. RadListBox bound to ObservableCollection<Country> CountryList
  2. RadListBox bound to ObservableCollection<Country> GroupA
  3. RadListBox bound to ObservableCollection<City> GroupD
  4. WPF ListBox bound to ObservableCollection<Country> GroupA, AllowDrop unset

The Drag-n-Drop behaviour is as expected, I can drag n drop between 1&2, but not to 3 or 4, it worked very well.

The top part is the identical setup, except it is contained within a RadTileView, and there are a few unexpected behaviours:

  1. Cursor no longer change to Cursors.No when drag over list 3 & 4
  2. When dropped on list 3, nothing happens, this is good. But when dropped on list 4 or anywhere on the tileview that's not a RadListBox, the item is removed from the drag source, and not added to anywhere.

So how do I fix these two issues?
Zarko
Telerik team
 answered on 26 Oct 2012
1 answer
85 views
Hi All,

I want create the RadGridView Control with Editable Rows. Once i Edit the GridView's last row then pressing enter should add the new row and focus should be in the First column. Can you guide me on this? Also if there is any sample please share with me...

Thansk and Regards,
Sakthi 
Dimitrina
Telerik team
 answered on 26 Oct 2012
1 answer
166 views
Hi,

How can I create shapes and connection objects not in the UI thread?
*diagram.Items.Add will be done in the UI thread...

Kind regards,
Igor
Zarko
Telerik team
 answered on 26 Oct 2012
3 answers
102 views
Hi,

I am using a class as per your Helpfile.when i use this systax as <local:CustomDragDropBehavior />    .It shows me error  as "Type not found.Verify that you are missing an assemble refernce".How to fix this Problem?

<Page x:Class="Page1"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
            mc:Ignorable="d"
            d:DesignHeight="300" d:DesignWidth="300"
            Title="Page1">
        <Grid>
        <telerik:RadGanttView x:Name="radchart" TasksSource="{Binding Tasks}" >
<telerik:RadGanttView.DragDropBehavior>
        <local:CustomDragDropBehavior />   
    </telerik:RadGanttView.DragDropBehavior>
            <telerik:RadGanttView.Columns>
                <telerik:ColumnDefinition MemberBinding="{Binding Start}" Header="Start" ColumnWidth="140">
                    <telerik:ColumnDefinition.CellEditTemplate>
                        <DataTemplate>
                            <!--<telerik:RadDateTimePicker SelectedValue="{Binding Start,Mode=TwoWay}" />-->
                        </DataTemplate>
                    </telerik:ColumnDefinition.CellEditTemplate>
                </telerik:ColumnDefinition>
                <telerik:ColumnDefinition MemberBinding="{Binding End}" Header="End" ColumnWidth="140">
                    <telerik:ColumnDefinition.CellEditTemplate>
                        <DataTemplate>
                            <!--<telerik:RadDateTimePicker SelectedValue="{Binding End,Mode=TwoWay}" />-->
                        </DataTemplate>
                    </telerik:ColumnDefinition.CellEditTemplate>
                </telerik:ColumnDefinition>
                <telerik:ColumnDefinition MemberBinding="{Binding Progress}" Header="Progress" ColumnWidth="100">
                    <telerik:ColumnDefinition.CellEditTemplate>
                        <DataTemplate>
                            <!--<telerik:RadNumericUpDown Value="{Binding Progress, Mode=TwoWay}" CustomUnit="%" Minimum="0"
                        Maximum="100" />-->
                        </DataTemplate>
                    </telerik:ColumnDefinition.CellEditTemplate>
                </telerik:ColumnDefinition>
            </telerik:RadGanttView.Columns>
        </telerik:RadGanttView>
    </Grid>
</Page>
Yana
Telerik team
 answered on 26 Oct 2012
4 answers
179 views
I am trying to draw some polygons and within the polygons I want to put information about the polygon.  

Eventually I will have multiple textblocks in the stackpanel.  I don't understand how to bind to my additional data.  I am using MVVM and my polygon binds good to Points. 

If I change the textblock to 
<TextBlock Text="Test" /> the textblock will show in the polygon with Test.  Output does not show any binding issues, it just doesn't work.  

<
telerik:RadMap x:Name="radMap" Center="49.002049,-101.367682" ZoomLevel="8" Width="1350" Height="700">
<telerik:InformationLayer x:Name="infoLayer" ItemsSource="{Binding Model.Items}">
    <telerik:InformationLayer.ItemTemplate>
        <DataTemplate>
        <telerik:MapPolygon Points="{Binding Points}" Fill="Green" >
        <telerik:MapPolygon.CaptionTemplate  >
            <DataTemplate>
                <StackPanel Background="Yellow" >
                        <TextBlock Text="{Binding SubItem}" />
                </StackPanel>
            </DataTemplate>
        </telerik:MapPolygon.CaptionTemplate>
        </telerik:MapPolygon>
        </DataTemplate>
    </telerik:InformationLayer.ItemTemplate>
</telerik:InformationLayer>
</telerik:RadMap>



Andrey
Telerik team
 answered on 26 Oct 2012
3 answers
116 views
Hi everyone,
I'm desperately trying to show a tooltip on a SplineSeriesDefinition, but it doesn't work. I've read the most of the related post but unluckily, I wasn't able to fix my problem. I have a DataSeries populated with several DataPoint. I tried to set the tooltip on every DataPoint, on the SplineSeriesDefinition and even on the SeriesMapping unsuccessfully. All that I want is a tooltip when mouse is over the curve. Please, I urgently need to fix this problem. Might someone help me, please?
Below there's the definition of the RadChart in my XAML code, and a piece of code of my CS file:

<telerik:RadChart Name="radChartCurva" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Left" Grid.Row="0" />

foreach (DatosGrafica graf in media)
                        {
                            DataPoint dp = new DataPoint(graf.valorX, graf.ValorPunto);
                            dp.Tooltip = graf.ValorPunto.ToString();
                            seriesCurva.Add(dp);
                            seriesMedia.Add(new DataPoint(graf.valorX, graf.Media));
                        }
                        seriesCurva.LegendLabel = StringResources.curve;
                        seriesMedia.LegendLabel = StringResources.average;
                        
                        SplineSeriesDefinition serieDef = new SplineSeriesDefinition();
                        SplineSeriesDefinition serieDef2 = new SplineSeriesDefinition();
                        serieDef.ShowItemLabels = false;
                        serieDef.ShowPointMarks = false;
                        serieDef.ShowItemToolTips = true;
                        serieDef2.ShowItemLabels = false;
                        serieDef2.ShowPointMarks = false;
                        serieDef2.ShowItemToolTips = true;


                        seriesCurva.Definition = serieDef;
                        seriesMedia.Definition = serieDef2;


                        SeriesMapping sm = new SeriesMapping();
                        sm.SeriesDefinition = serieDef;
                        sm.ItemMappings.Add(new ItemMapping("XValue",DataPointMember.XValue));
                        sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
                        this.radChartCurva.SeriesMappings.Add(sm);
                        this.radChartCurva.DefaultView.ChartArea.DataSeries.Add(seriesMedia);
                        this.radChartCurva.DefaultView.ChartArea.DataSeries.Add(seriesCurva);

What's wrong with my code?

Thanks in advance guys :-)
Davide
Top achievements
Rank 1
 answered on 26 Oct 2012
3 answers
167 views
we've tried implementing a radgridview which synchronizes with a data form thru element binding within a backstage item of the ribbonview and found it now working. so we tested a simple textbox to textblock element binding and it still does not work.

something like this:

<telerikRibbon:RadRibbonBackstageItem Header="Recent" IsDefault="True">
     <StackPanel Margin="15 15 0 0">
          <TextBlock Text="{Binding ElementName=testtext, Path=Text}"/>
          <TextBox x:Name="testtext" />
     </StackPanel>
</telerikRibbon:RadRibbonBackstageItem>

we are using the Q2 version if it helps.

thanks
Pavel R. Pavlov
Telerik team
 answered on 26 Oct 2012
6 answers
234 views
Hi,

In one of my projects,I use WCF data services for querying the database,and use GridView, and DataForm for viewing and editing data.When the user double click on a row, I create a filtered DataServiceQuery (e.g. ID=55) and use it to initialize a QueryableDataServiceCollectionView<T> which I then assign to the RadDataForm ItemsSource.I can successfully add ,delete, and edit records by calling SubmitChanges() on the ItemsSource (which is of type QueryableDataServiceCollectionView<T>),
 but I am facing other difficulties:

1-I have an entity Sim which has a 1 to many association property called Installations. When clicking Cancel while editing or inserting in the DataForm, I get the following error which seems to be caused by the DataForm trying to set a value on the Installations property.

Setting an instance of DataServiceCollection to an entity property is disallowed if the instance is already being tracked. Error occurred on property 'Installations' for entity type 'TDS.DeviceManagementDataService.Sim'.


2-When I open an existing record for editing,and click the 'insert' button,fill-in the form,and click save,the record is saved but the form goes back and display the record that was being edited earlier.

My last question is: what is the best way of databinding a RadDataForm when working with WCF data service ?

GridView Double Click Code:

private void SimsGridView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {          
            SimView view = new SimView();
            QueryableDataServiceCollectionView<Sim> dataContext = new Telerik.Windows.Data.QueryableDataServiceCollectionView<Sim>(db, db.Sims.Where(i => i.ID == SimsGridView.GetSelectedItem<Sim>().ID).ToDataServiceQuery<Sim>());
            dataContext.PageSize = 100;
            dataContext.AutoLoad = true;
            view.DataContext = dataContext;
            view.Show();
            view.Focus();
            
        }

SimView Window:

<telerik:RadDataForm x:Name="rdfSim" ItemsSource="{Binding}" AutoGenerateFields="False"  HorizontalAlignment="Stretch"  VerticalAlignment="Stretch"
            ReadOnlyTemplate="{StaticResource MyTemplate}" NewItemTemplate="{StaticResource MyTemplate}"
                                 EditTemplate="{StaticResource MyTemplate}" EditEnded="rdfSim_EditEnded"
                                  CommandButtonsVisibility="All"   ValidatingItem="rdfSim_ValidatingItem" DeletedItem="rdfSim_DeletedItem">         
 
        </telerik:RadDataForm>



Thanks in advance

Madani
Chris
Top achievements
Rank 1
 answered on 26 Oct 2012
5 answers
250 views
I am using RadGridView for WPF 2012.3.1017.40

There is some issue with the column header depending on the type of XAML I invoked

When I use:
<telerik:GridViewDataColumn UniqueName="Year"  Header="Year" />
The grid does persists with the expected header "Year"

However when I use:
<telerik:GridViewDataColumn UniqueName="Year" >
                    <telerik:GridViewDataColumn.Header>
                        <TextBlock Text="Year" />
                    </telerik:GridViewDataColumn.Header>
                </telerik:GridViewDataColumn>

The following is injected into the persisted XML
    <PV Key="12" TypeKey="-664072138">
      <Value xsi:type="xsd:string"<System.Windows.Controls.TextBlock</Value>
    </PV>
and instead of "Year" in the Column header the grid persists the words "System.Windows.Controls.TextBlock" into the header instead.

Please note, it appears to be an extra < being injected within the value element. However I need the word "Year" instead.

How can I fix this?
Thank you,
Alan Painter
Dimitrina
Telerik team
 answered on 26 Oct 2012
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?