Telerik Forums
UI for WPF Forum
13 answers
432 views
Hi

I am building a custom polyline tool, all I want is to add points and have a preview of the line that is going to be added (check the GIF to see what I am trying to achieve).

Here is the tool:
public class PolylineShapeTool : ToolBase, IMouseListener
  {
      private LineSegment _currentLineSegment;
      private PathFigure _currentPathFigure;
      private PathSegmentCollection _currentPathSegmentCollection;
      private RadDiagramShape _currentShape;
 
      public PolylineShapeTool()
          : base("PolylineShapeTool")
      {
      }
 
      private RadDiagram Diagram
      {
          get { return Graph as RadDiagram; }
      }
 
      public bool MouseDown(PointerArgs e)
      {
          return false;
      }
 
      public bool MouseDoubleClick(PointerArgs e)
      {
          return false;
      }
 
      public bool MouseMove(PointerArgs e)
      {
          if (IsActive && _currentShape != null)
          {
              if (_currentLineSegment != null)
              {
                  var rect = CalculateRectFromBasePoint(e.TransformedPoint);
 
                  _currentLineSegment.Point = e.TransformedPoint;
                  _currentShape.Width = rect.Width;
                  _currentShape.Height = rect.Height;
              }
 
              return true;
          }
 
          return false;
      }
 
      public bool MouseUp(PointerArgs e)
      {
          if (IsActive)
          {
              _currentLineSegment = new LineSegment { Point = e.TransformedPoint };
 
              if (_currentPathSegmentCollection == null)
              {
                  _currentPathSegmentCollection = new PathSegmentCollection();
 
                  _currentPathFigure = new PathFigure
                  {
                      StartPoint = e.TransformedPoint,
                      Segments = _currentPathSegmentCollection,
                      IsFilled = false,
                      IsClosed = false
                  };
                   
                  var pathGeometry = new PathGeometry { Figures = new PathFigureCollection { _currentPathFigure } };
 
                  _currentShape = new RadDiagramShape { Geometry = pathGeometry};
 
                  Diagram.AddShape(_currentShape);
              }
 
              _currentPathSegmentCollection.Add(_currentLineSegment);
              _currentPathFigure.Segments = _currentPathSegmentCollection;
 
              return true;
          }
 
          return false;
      }
 
      protected override void OnDeactivated()
      {
          base.OnDeactivated();
 
          _currentShape = null;
          _currentLineSegment = null;
          _currentPathFigure = null;
          _currentPathSegmentCollection = null;
      }
 
      private Rect CalculateRectFromBasePoint(Point transformedPoint)
      {
          var width = Math.Abs(_currentShape.X - transformedPoint.X);
          var height = Math.Abs(_currentShape.Y - transformedPoint.Y);
          var x = Math.Min(_currentShape.X, transformedPoint.X);
          var y = Math.Min(_currentShape.Y, transformedPoint.Y);
 
          return new Rect(x, y, width, height);
      }
  }

The problem is that it isn't working as expected, despite setting the StartPoint of the PathFigure, the first line starts at (0,0).
What do I have to change in this or how could I create such tool?

Why I don't use the Path tool? Because I don't need Bezier curves and there's no preview for the current line.
Maurício
Top achievements
Rank 1
 answered on 13 Feb 2015
2 answers
158 views
If followed the Telerik ControlPanelItem "Column chooser" example. It works perfect, though now I have two entries for the GridViewSelectColumn and GridViewToggleRowDetailsColumn which I don't want to display. Is there a way to remove those from the columns list?
Heiko
Top achievements
Rank 1
Iron
Veteran
 answered on 13 Feb 2015
1 answer
340 views
Hello,

I have a local tile package file that has my basemap I can use in an offline application. A description of tile packages is given below:

http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/About_tile_packages/01700000004w000000/

Is it possible to have a custom map provider to be able to read this file and load it into the RadMap control? I did not find any existing examples doing this. Any help would be appreciated, thanks!
Martin Ivanov
Telerik team
 answered on 13 Feb 2015
3 answers
361 views
I am printing a WPF screen, using the PrintDialog.PrintVisual method.  All of the bound controls on the screen print correctly except for the two Telerik controls - RadCartesianChart and RadPieChart.  Both of these controls display the message "No data to plot" on the printout.

The data in the controls is bound to the datacontext; and displays correctly in the screen when displayed, the only issue is when printed.  Would you expect bound Telerik controls to print correctly?

Thanks.
Milena
Telerik team
 answered on 13 Feb 2015
3 answers
218 views
Hi All

I have an issue with binding of a control which is inside header of a RadGridView which is in an Expander where Expander.IsExpanded
=False


<telerik:GridViewDataColumn.Header>
     <CheckBox IsChecked="{Binding DataContext.MyProperty, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</telerik:GridViewDataColumn.Header>


When I set IsExpanded=True, binding to checkbox starts working as normal.

As a workaround I did this in code behind ..

Private Sub CheckBox_OnLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim chk As CheckBox = sender
            chk.DataContext = DataContext
            Dim b As Binding = New Binding("MyProperty")            
            chk.SetBinding(CheckBox.IsCheckedProperty, b)         
End Sub

This works, but I don't want to do this as its not great coding practice and any I will have to repeat this like 1000s time that I don't wanna do..

please tell me what options do I have here.

Thanks
M. 






Boris
Telerik team
 answered on 13 Feb 2015
12 answers
253 views
Hi,

I want to show Exponential  on XAxis,how we can do, do you have any example?

second question, 
Can we flip XAxis, like right side to left side.

Thanks


Petar Marchev
Telerik team
 answered on 13 Feb 2015
1 answer
133 views
I'm using virtualization in a RadMap. How can my ShapeDataVirtualizer class (based on IMapItemsVirtualizationSource) get to the DataContext object which is set on the parent Window?

Andrew
Pavel R. Pavlov
Telerik team
 answered on 13 Feb 2015
5 answers
472 views
I've read the documentation that explains how to filter on the Date value only from here:
http://docs.telerik.com/devtools/wpf/controls/radgridview/filtering/how-to/howto-filter-date-value

But my grid is using auto-generated columns. How do I get this work when I'm not declaring each individual column?
Dimitrina
Telerik team
 answered on 13 Feb 2015
2 answers
199 views
Dear Telerik Support,

How can I disable the compass which is appear in all RadSplitContainer when I drag a floatable item?

Thanks,
Rob


Robert
Top achievements
Rank 1
 answered on 13 Feb 2015
1 answer
120 views
An error occurred trying to download 'http://demos.telerik.com/wpf/crm/CRM.application'.
Dimitrina
Telerik team
 answered on 13 Feb 2015
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?