Telerik Forums
UI for WPF Forum
1 answer
97 views
How does i go about making custom drawing tool, had no luck finding any resources on this area.

I am trying to make a LineTool.

Currently i am Initializing the tool like this. Which i am aware might be incorrect but using "LineTool" results in no geometry being shown.

DrawingService.InitializeDraw(shape, "PencilTool"); //LineTool does not show anything


Also i need the ManipulationAdorner changed but only when a single LineShape is selected. I would like two resize handles at the end of the line. The diagram will contain other shapes that still will show four resize handles. Is it possible to make different styles for the ManipulationAdorner dependent on what the current selection is.


public override bool MouseDown(PointerArgs e)
        {
            if (!IsActive)
                return false;

            DrawingService.StartDraw();
            DrawingService.DrawPoints(e.TransformedPoint, e.TransformedPoint);

            return base.MouseDown(e);
        }

        public override bool MouseMove(PointerArgs e)
        {
            if (!IsActive || !ToolService.IsMouseDown || (ToolService.IsControlDown || !DrawingService.IsDrawing))
                return false;
            
            if (DrawingService.ActiveShape == null)
            {
                var shape = CreateShape();
                shape.IsSelected = true;
                shape.Geometry = new LineGeometry(e.TransformedPoint, e.TransformedPoint);

                DrawingService.InitializeDraw(shape, "PencilTool"); //LineTool does not show anything
                //SelectionService.ClearSelection();
                
                return base.MouseMove(e);
            }


            if (DrawingService.AnchorPoints.Count() > 1)
                DrawingService.RemoveLastAnchorPoint();
                
            DrawingService.DrawPoints(e.TransformedPoint, e.TransformedPoint);
            return true;
        }

        public override bool MouseUp(PointerArgs e)
        {
            if (!IsActive || !DrawingService.IsDrawing)
                return base.MouseUp(e);
            CompleteTool();
            _diagram.ActiveTool = MouseTool.PointerTool;
            return true;
        }
Anders Lind
Top achievements
Rank 1
 answered on 07 Jan 2015
2 answers
452 views
There are data for whole year with 1 minute time step. It's 525,600 points. 
I'm trying to use DateTimeContinuousAxis, but its properties behavior is really strange.

I need ticks for first minute of each day. But setting MajorStep="1" MajorStepUnit="Day" results in attached image. (It results in 1 tick per 2 hours for some reason)
Is there way to get one tick for day?

Note, that I also use Pan/Zoom feature.

Thanks,
Michael



MainWindow.xaml.cs

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        DataContext = this;
        var c = 365*24*60;
        var data = new List<Step>(c);
        var random = new Random();
        for (var minute = 0; minute < c; minute++)
        {

            var date = new DateTime(2006, 1, 1) + TimeSpan.FromMinutes(minute);
            var value = random.Next(1800, 2000);
            data.Add(new Step {Value = value, Date = date});
        }
        Data = data;
    }

    public static readonly DependencyProperty DataProperty = DependencyProperty.Register("Data",
        typeof (IEnumerable<Step>), typeof (MainWindow), new PropertyMetadata(null));

    public IEnumerable<Step> Data
    {
        get { return (IEnumerable<Step>) GetValue(DataProperty); }
        set { SetValue(DataProperty, value); }
    }
}

public class Step
{
    public Double Value { get; set; }
    public DateTime Date { get; set; }
}



MainWindow.xaml

<Window x:Class="telerik_chart_big_data.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <telerik:RadCartesianChart x:Name="Chart" Zoom="12.1,1" PanOffset="0,0" MaxZoom="365,1">
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior ZoomMode="Horizontal"/>
            </telerik:RadCartesianChart.Behaviors>
           
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeContinuousAxis Title="X" LabelFitMode="MultiLine" PlotMode="OnTicks" MajorStep="1" MajorStepUnit="Day"/>
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis Title="Y"/>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:LineSeries ItemsSource="{Binding Data}" RenderMode="Light" ValueBinding="Value" CategoryBinding="Date" Stroke="Red"/>            
        </telerik:RadCartesianChart>
    </Grid>
</Window>











Petar Marchev
Telerik team
 answered on 07 Jan 2015
7 answers
475 views
Below are the Details for Docking Pin/Unpin issue.

Control Name -  DockingDlls
Version - 2014.1.331.45
Issue – Unable to minimize all Rad Panes in RadPaneGroup (Move all related panes in to vertical bar), when Unpin any one RadPane in RadPaneGroup.

Implementation -  RadpaneGroup placed inside RadSplitContainer then RadSplitContainer placed inside RadDocking control.

Added following Pin and Unpin event handlers.   

private void RadDocking_OnPin(object sender, StateChangeEventArgs e)
        {
            foreach (var moduleItem in e.Panes)
            {
                var radPaneItem = moduleItem;                if (radPaneItem != null)
                {
                    if (radPaneItem.PaneGroup.Name == "NavigationPanesGroup")
                    {
                        NavigationPanesGroup.PinAllPanes();
                    }                    if (radPaneItem.PaneGroup.Name == "QuickAccessPanesGroup")
                    {
                        QuickAccessPanesGroup.PinAllPanes();
                    }
                }
            }
        }        private void RadDocking_OnUnpin(object sender, StateChangeEventArgs e)
        {
            foreach (var moduleItem in e.Panes)
            {
                var radPaneItem = moduleItem;                if (radPaneItem != null)
                {
                    if (radPaneItem.PaneGroup.Name == "NavigationPanesGroup")
                    {
                        NavigationPanesGroup.UnpinAllPanes();
                    }                    if (radPaneItem.PaneGroup.Name == "QuickAccessPanesGroup")
                    {
                        QuickAccessPanesGroup.UnpinAllPanes();
                    }
                }
            }
        }
Above code works good for Pin/Unpin functionality, But all panes in RadPanesGrup not moving to VerticalBar. Only Unpinned RadPane item is moving to verticalBar.

Please give pointers/suggestions to unpin and minimize all Radpanes, when we Unpin any RadPane.

I have attached sample project in this post.
Vladi
Telerik team
 answered on 07 Jan 2015
1 answer
117 views
I am trying to create a custom filter tool for a group of texts

I have the following XAML http://pastebin.com/h41fjb9J and codebehind is http://pastebin.com/PTd48bJZ and my custom type is http://pastebin.com/LFnGynbz

What I dont understand is that if I have 
                    <telerik:GridViewDataColumn
                        DataMemberBinding="{Binding Path=Checked}"/>
                    <telerik:GridViewDataColumn
                        IsReadOnly="True"
                        DataMemberBinding="{Binding Path=Text}"/>

Then it works but its ugly as I want to it look exactly like the 
<CheckBox Content="{x:StaticExtension localization:SemenBucketTexts.SelectAll}" Click="SelectAll" />
above with no borders or headers

If I then try to create a custom celltemplate 

                    <telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Checked="{Binding Path=Checked}" Content="{Binding Text}"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>

I get an exception 
InnerException = {"Unable to cast object of type 'System.Reflection.RuntimeEventInfo' to type 'System.Reflection.MethodInfo'."}



Ivan Ivanov
Telerik team
 answered on 06 Jan 2015
3 answers
275 views
I have trouble with creating a custom cell template for my custom filtering

I have the following xaml file
http://pastebin.com/12MYWM6J

And this codebehind
http://pastebin.com/c0JVMnQU

And this is my custom type
http://pastebin.com/LFnGynbz

My problem is that if I do not comment out 

<telerik:GridViewDataColumn>
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <CheckBox Checked="{Binding Path=Checked}" Content="{Binding Text}"/>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>


Then my application throws an exception
{"Unable to cast object of type 'System.Reflection.RuntimeEventInfo' to type 'System.Reflection.MethodInfo'."}

If I do comment it out then it runs fine, but it looks wrong, I dont want

<telerik:GridViewDataColumn
    DataMemberBinding="{Binding Path=Checked}"/>
<telerik:GridViewDataColumn
    IsReadOnly="True"
    DataMemberBinding="{Binding Path=Text}"/>


I want the checkboxes I create in my radgridview to align with the one in top
<CheckBox Content="{x:StaticExtension localization:SemenBucketTexts.SelectAll}" Click="SelectAll" />
Ivan Ivanov
Telerik team
 answered on 06 Jan 2015
1 answer
122 views
Hi,

I would like to know if Telerik have a control to do something like what Microsoft InfoPath do?

Thank's
Alain
Petya
Telerik team
 answered on 06 Jan 2015
1 answer
667 views
I am trying to override the default clipboard behavior to only support pasting plain text using the following code:

ClipboardEx.ClipboardHandlers.Clear();
var clipboardHandler = new ClipboardHandler();
clipboardHandler.ClipboardDataFormat = DataFormats.Text;
clipboardHandler.DocumentFormatProvider = new TxtFormatProvider();
ClipboardEx.ClipboardHandlers.Add(clipboardHandler);

This seems to work appropriately when pasting from an application such as MS Word. However, if I copy from a RadRichTextBox and then paste into the same RadRichTextBox, the formatting is preserved. How can I also paste plain text when copying from the same RadRichTextBox I am pasting into?
Boby
Telerik team
 answered on 06 Jan 2015
1 answer
178 views
Hi, after moving from Telerik 2013.3 to 2014.3 we get an exception when the popupmenuitems in a radribbongallery is about to expand. We are using the same control several places in our application and it only fails one place, so it takes some wizardry to make it fail. I am not able to reproduce this in a test exampleb but if you by chance have any suggestions on things to try it would be appreciated.

Here's a simpliefied xaml that fails:
            <telerik:RadRibbonGallery.PopupMenuItems>
                <telerik:RadMenu ClickToOpen="False">
                <telerik:RadMenuItem Header="Test">
                    <telerik:RadMenuItem Header="Test submenu"/>
                </telerik:RadMenuItem>
                </telerik:RadMenu>
            </telerik:RadRibbonGallery.PopupMenuItems>

Here's the exception details:

Exception1:
Cannot perform action because the specified Storyboard was not applied to this object
for interactive control.

System.Windows.Media.Animation.Storyboard

GetStoryboardClock

Source:
PresentationFramework


Target:
System.Windows.Media.Animation.Clock
GetStoryboardClock(System.Windows.DependencyObject, Boolean,
InteractiveOperation)

 

Stacktrace:   
at
System.Windows.Media.Animation.Storyboard.GetStoryboardClock(DependencyObject
o, Boolean throwIfNull, InteractiveOperation operation)

  
at System.Windows.Media.Animation.Storyboard.GetCurrentStateImpl(DependencyObject
containingObject)

  
at System.Windows.Media.Animation.Storyboard.GetCurrentState()

  
at
Telerik.Windows.Controls.Animation.AnimationManager.StopIfRunning(FrameworkElement
target, String animationName, Boolean animateSelf)

  
at Telerik.Windows.Controls.RadMenuItem.OnIsSubmenuOpenChanged(DependencyObject
d, DependencyPropertyChangedEventArgs e)

  
at
System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)

  
at
System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)

  
at
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs
args)

  
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex,
DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry,
EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean
coerceWithCurrentValue, OperationType operationType)

  
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object
value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean
coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

  
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object
value)

  
at Telerik.Windows.Controls.RadMenuItem.set_IsSubmenuOpen(Boolean value)

  
at Telerik.Windows.Controls.RadMenuItem.CloseMenu()

  
at Telerik.Windows.Controls.RadMenuItem.OnIsSelectedChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)

  
at
System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)

  
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs
e)

  
at
System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs
args)

  
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex,
DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry,
EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean
coerceWithCurrentValue, OperationType operationType)

  
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object
value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean
coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

  
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object
value)

  
at Telerik.Windows.Controls.RadMenuItem.set_IsSelected(Boolean value)

  
at Telerik.Windows.Controls.MenuBase.set_CurrentSelection(RadMenuItem value)

  
at Telerik.Windows.Controls.MenuBase.CloseAll()

  
at Telerik.Windows.Controls.RadMenuItem.OnCloseTimerTick(Object sender,
EventArgs e)

  
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)

  
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)





Milena
Telerik team
 answered on 06 Jan 2015
2 answers
279 views
Is there any way to make the number scale within the gauge match the Outerborder of the gauge? It seems to be wider at the base of the gauge and if I want to add a GaugeRange it looks odd. thanks chuckl 

<telerik:RadSemicircleNorthGauge Width="182.5" Height="100" InnerBackground="white" OuterBackground="WhiteSmoke" OuterBorderThickness="0">
<telerik:SemicircleNorthScale ShowLastLabel="False" FontSize="11" VerticalAlignment="Center" Min="0" Max="99" RangeOffset="7" >
<telerik:SemicircleNorthScale.Indicators>
<telerik:Needle Value="65" />
<telerik:Pinpoint />
</telerik:SemicircleNorthScale.Indicators>
<telerik:SemicircleNorthScale.Ranges>
<telerik:GaugeRange Min="0" Max="65" Background="Green" />
<telerik:GaugeRange Min="65" Max="99" Background="Red"/>
</telerik:SemicircleNorthScale.Ranges>
</telerik:SemicircleNorthScale>
</telerik:RadSemicircleNorthGauge>

<telerik:RadSemicircleNorthGauge Width="182.5" Height="100" InnerBackground="WhiteSmoke"
OuterBackground="WhiteSmoke" Background="WhiteSmoke" BorderBrush="WhiteSmoke" OuterBorderThickness="1">
<telerik:SemicircleNorthScale FontSize="11" VerticalAlignment="Center" Min="0" Max="100" MajorTicks="10" MiddleTicks="1" >
<telerik:SemicircleNorthScale.Indicators>
<telerik:Needle Value="26" />
<telerik:Pinpoint />
</telerik:SemicircleNorthScale.Indicators>
</telerik:SemicircleNorthScale>
</telerik:RadSemicircleNorthGauge>
Martin Ivanov
Telerik team
 answered on 06 Jan 2015
1 answer
235 views
Hello,

When displaying scatter plots, I like to use the following three properties on my ScatterSeries:
ClipToBounds=False, ClipToPlotArea=False, and ZIndex=1000 
to ensure the points don't get clipped by the axes and boundary scrollbars.  See attached pic for the result, when using a single series.

I'm not quite sure how to set the ZIndex of the scatter series when using a ChartSeriesProvider though for dynamic series.  It lets me set the ClipToBounds and ClipToPlotArea properties, but not the ZIndex using attached properties.

<telerik:ChartSeriesProvider Source="{Binding MultiSeriesData}">
    <telerik:ChartSeriesProvider.SeriesDescriptors>
        <telerik:ScatterSeriesDescriptor ItemsSourcePath="Data" XValuePath="X" YValuePath="Y">
            <telerik:ScatterSeriesDescriptor.Style>
                <Style TargetType="telerik:ScatterPointSeries" BasedOn="{StaticResource ScatterPointSeriesStyle}">
                    <Setter Property="ClipToBounds" Value="False" />
                    <Setter Property="ClipToPlotArea" Value="False" />
            <!-- I'd like to be able to do the following, but it causes an error -->
            <!-- <Setter Property="ZIndex" Value="1000" /> -->
                </Style>
            </telerik:ScatterSeriesDescriptor.Style>
        </telerik:ScatterSeriesDescriptor>
    </telerik:ChartSeriesProvider.SeriesDescriptors>
</telerik:ChartSeriesProvider>

Any suggestion on how to set the ZIndex of the dynamic scatter series?  It doesn't matter to me if they're all the same value, they just need to be higher than the chart boundary scrollbars.
Petar Marchev
Telerik team
 answered on 06 Jan 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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?