Telerik Forums
UI for WPF Forum
1 answer
210 views
Hi,
  I've got a problem with the new RadialMenu. I'm trying to using it into a Grid object and open it with the option PopupPlacement="MousePoint".
   <Grid x:Name="myGrid">
        <telerik:RadRadialMenu.RadialContextMenu>
            <telerik:RadRadialMenu PopupPlacement="MousePoint" IsOpen="True" StaysOpenOnShow="True">
                <telerik:RadRadialMenuItem>
                    <telerik:RadRadialMenuItem Header="Refresh" CommandParameter="REFRESH" />
                    <telerik:RadRadialMenuItem Header="Search" CommandParameter="SEARCH" ContentSectorBackground="LightBlue" />
                </telerik:RadRadialMenuItem>
            </telerik:RadRadialMenu>
        </telerik:RadRadialMenu.RadialContextMenu>
        <Image Source="landscape.jpg" />
    </Grid>
I've used the same algorithm used in the Demo for showing / hiding the ContextMenu:

private void OnEditorMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                var radialMenu = RadRadialMenu.GetRadialContextMenu(this.Editor);
                var mousePoint = e.GetPosition(this.Editor as IInputElement);
                radialMenu.PopupHorizontalOffset = mousePoint.X;
                radialMenu.PopupVerticalOffset = mousePoint.Y;
                RadialMenuCommands.Show.Execute(null, this.Editor);
            }
        }

private void OnEditorMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                RadialMenuCommands.Hide.Execute(null, sender as IInputElement);
            }
        }
For the first click everything is working fine and the RadialContextMenu is shown exactly centered with the Mouse Pointer but... after the second click the RadialContextMenu popup as it was PopupPlacement="Mouse".

Is it a bug ?


Thanks for the help



Kalin
Telerik team
 answered on 17 Feb 2015
1 answer
153 views
I've implemented Drag & Drop into a RadGridView. The DataObject I'm dropping is a string.

I need to detect whether the string is dropped into a Cell (in which case it will add the string to the cell value) or elsewhere on the RadGridView (where a new row will be created).

private void OnDropAttributes(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            DataObject data = (args.Data as DataObject);

            ...?
Nick
Telerik team
 answered on 17 Feb 2015
4 answers
193 views
The version of Telerik UI for WPF that is currently bundled with an application I am working on is 2014.1.0224.40.

This version number does not seem to map to your version scheme for you quarterly releases (n.x.yy.zzzz). Can you tell me if version 2014.1.0224.40 is equivalent to a specific release of Telerik UI for WPF?

I am doing some feasibility work for a reporting framework and was evaluating Telerik Reports for WPF. Telerik Reports for WPF has some dependencies on components of Telerik UI for WPF, but I want to match the versions of the components (Reporting and UI) and I can't find a corresponding Telerik Reports for WPF version.
kaczmar2
Top achievements
Rank 1
 answered on 16 Feb 2015
1 answer
142 views
Hello Support,

     <telerik:RadCartesianChart.Behaviors>
            <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated" />
            <telerik:ChartSelectionBehavior DataPointSelectionMode="Single" SelectionChanged="RadChart1_SelectionChanged" />
         </telerik:RadCartesianChart.Behaviors>


<!-- This code does not work, when i click on all of the points on the line, i never have the event triggered  -->
         <telerik:ScatterLineSeries ItemsSource="{Binding LineProfileDataValues}"
                                  YValueBinding="RedBandOrMonoValue" XValueBinding="PixelNumber" Stroke="Red" Width=".5" TrackBallTemplate="{StaticResource trackBallTemplateR}" IsHitTestVisible="True">


<!-- If i simple change from a LineSeries to a ScatterPointSeries, then the event is triggered and everything works correctly  -->
         <telerik:ScatterPointSeries ItemsSource="{Binding LineProfileDataValues}"
                                  YValueBinding="RedBandOrMonoValue" XValueBinding="PixelNumber" TrackBallTemplate="{StaticResource trackBallTemplateR}" IsHitTestVisible="True">




Martin Ivanov
Telerik team
 answered on 16 Feb 2015
1 answer
85 views
Hello,

I am using the trackBallInfo template to show data very similar to the example in the Demo.
I would like the position of the Databox inside the chart to follow the Y of the mouse.  The reason is because, if my data goes into the high range they the trackballinfo covers the line and you cannot see the chart.

Is there a way to do this?
Pavel R. Pavlov
Telerik team
 answered on 16 Feb 2015
2 answers
166 views
Hi,

I'm currently trying to populate a RadDateTimePicker control with data during an automation test (using the Microsoft automation tests framework). I've succeeded in populating edit controls using the ValuePattern.Pattern - but using this with the RadDateTimePicker fails. The C# test code is (where HostAutomationElement is the root element of the ApplicationUnderTest):

string theDateWeNeedToSetAsAString = "01/01/2015";
HostAutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "StartDate"))
ValuePattern valuePattern = StartDateDatePickker.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
valuePattern.SetValue(theDateWeNeedToSetAsAString);

<telerik:RadDateTimePicker x:Name="StartDate"
                       Width="200" HorizontalAlignment="Left"
                       InputMode="DatePicker"
                       SelectedValue="{Binding StartDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}"
                       AutomationProperties.AutomationId="TheStartDate"/>


The error I get is an ElementNotAvailableException and the inner exception of this says: "Operation is not valid due to the current state of the object." which is fired from :at System.Windows.Automation.ValuePattern.SetValue(String value)

Is there an alternative pattern I should be using for this?  Enumerating the available patterns for the control gives me:

ValuePatternIdentifiers.Pattern
ExpandCollapsePatternIdentifiers.Pattern
SynchronizedInputPatternIdentifiers.Pattern

I don't want to expand/collapse - and the SynchronizedInputPattern seems too low level. Is there something else I have to do to get data into the RadDateTimePicker control within a test environment?

Cheers,
Tom.
Georgi
Telerik team
 answered on 16 Feb 2015
2 answers
144 views
Hi all,

When i mailMerge in header and footer areas and export with DocxFormatProvider or XamlFormatProvider. Header mergefields are empty. They can't save.
Kammen
Telerik team
 answered on 16 Feb 2015
5 answers
371 views
I have to create some dynamic data fields inside RadDataForm so I've added an ItemsControl inside my RadDataForm. Please see code below for example. Everything works fine. A custom DataTemplateSelector checks a property called Value. If Value is of type string ItemsControl is using DataFormDataField template to display it with a TextBox. If Value is of type datetime ItemsControl is using DataFormDateField template to display it with a RadDatePicker. That's great but I'm having trouble with validation. I use Item level attribute-based validation as described in your documentation. This works perfect on usual data fields like the two shown below (ID and Name). But validation is not executed on my bound properties inside those mentioned DataTemplates. Inside every DataTemplate there is a DataBinding to property Value of my ViewModel. Just like ID and Name, Value also has Item level attribute-based validation ([Required(AllowEmptyStrings = false)]). When ID or Name are empty validation comes into place and I can not commit RadDataForm until I enter some text. That's what I want for my Value property, too. I hope this is understandable.


<!-- ID -->
<t:DataFormDataField Label="ID" Description="Todo" DataMemberBinding="{Binding ID, Mode=OneWay}">
    <t:DataFormDataField.Content>
        <t:RadWatermarkTextBox Text="{Binding ID, Mode=OneWay}" IsReadOnly="True" />
    </t:DataFormDataField.Content>
</t:DataFormDataField>
<!-- Name -->
<t:DataFormDataField Label="Name" Description="Todo" DataMemberBinding="{Binding Name, Mode=TwoWay, NotifyOnValidationError=True}">
    <t:DataFormDataField.Content>
        <t:RadWatermarkTextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WatermarkContent="Please fill in your name" />
    </t:DataFormDataField.Content>
</t:DataFormDataField>
<!-- DYNAMIC DATA FIELDS -->
<ItemsControl ItemsSource="{Binding Source={StaticResource CollectionViewSource}}" Focusable="False">
    <ItemsControl.ItemTemplateSelector>
        <v:MyDataTemplateSelector>
            <!-- Text DataTemplate (Value is string so show it in DataFormDataField) -->
            <v:MyDataTemplateSelector.TextBoxDataTemplate>
                <DataTemplate>
                    <t:DataFormDataField Label="{Binding Label, Mode=OneWay}" Description="{Binding ToolTip, Mode=OneWay}" DataMemberBinding="{Binding Value, Mode=TwoWay, NotifyOnValidationError=True}">
                        <t:DataFormDataField.Content>
                            <t:RadWatermarkTextBox Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WatermarkContent="Please insert value" />
                        </t:DataFormDataField.Content>
                    </t:DataFormDataField>
                </DataTemplate>
            </v:MyDataTemplateSelector.TextBoxDataTemplate>
            <!-- Date DataTemplate (Value is datetime so show it as DataFormDateField) -->
            <v:MyDataTemplateSelector.DateDataTemplate>
                <DataTemplate>
                    <t:DataFormDateField Label="{Binding Label, Mode=OneWay}" Description="{Binding ToolTip, Mode=OneWay}" DataMemberBinding="{Binding Value, Mode=TwoWay, NotifyOnValidationError=True}">
                        <t:DataFormDateField.Content>
                            <t:RadDatePicker DateSelectionMode="Year" SelectedValue="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </t:DataFormDateField.Content>
                    </t:DataFormDateField>
                </DataTemplate>
            </v:MyDataTemplateSelector.DateDataTemplate>
            <!-- More DataTemplates here ... -->
        </v:MyDataTemplateSelector>
    </ItemsControl.ItemTemplateSelector>
</ItemsControl>


Can you help me on this? I don't know what I am doing wrong here. It seems my validation rules/data annotations are just not recognized by RadDataForm when the binding is inside a DataTemplate.
​
Ivan Ivanov
Telerik team
 answered on 16 Feb 2015
4 answers
427 views
I have a list of 'Setting' objects in a ViewModel a RadPropertyGrid is bound to. I use OnLoaded event to populate PropertyDefinitions of the RadPropertyGrid with 'Setting' items from the list by creating a PropertyDefinition for each item. DisplayName and Description for each PropertyDefinition created from a 'Setting' object are set  correctly but I cannot set the Binding to display the actual value to be edited. Here is my code:

  foreach (var setting in vm.Settings)
  {     
      Binding myBinding = new Binding();
      myBinding.Source = setting;
      myBinding.Path = new PropertyPath("SomeProperty");
      var pd = new PropertyDefinition();
      pd.Binding = myBinding;
      pd.DisplayName = setting.Name;
      pd.Description = setting.Description;     
      ServerSettingsPropertyGrid.PropertyDefinitions.Add(pd);
  }

What am I doing wrong and how to properly set PropertyDefinition binding in code?
Dean
Top achievements
Rank 1
 answered on 13 Feb 2015
13 answers
348 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
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?