Telerik Forums
UI for WPF Forum
1 answer
110 views
Hi

Using the GraphSource for binding with Nodes and Links is it possible to style nodes within code and not using StyleSelectors? E.g. change a node to a elipse or triangle

Thanks
Pavel R. Pavlov
Telerik team
 answered on 23 Jan 2014
6 answers
352 views

I

 have a problem with CartesianCustomAnnotation. there is a RadCartesianChart with zoom ability,

<telerik:RadCartesianChart x:Name="chart"   Zoom="{Binding Zoom, Mode=TwoWay}" >
         <telerik:RadCartesianChart.Behaviors >
                       <telerik:ChartPanAndZoomBehavior ZoomMode="Both" PanMode="Horizontal" MouseWheelMode="Zoom" />
       </telerik:RadCartesianChart.Behaviors>
<!--some codes-->
</<telerik:RadCartesianChart >
then I programmatically added a triangle as CartesianCustomAnnotation
System.Windows.Shapes.Polygon triangle = new Polygon();
//some codes
 chart.Annotations.Add(new Telerik.Windows.Controls.ChartView.CartesianCustomAnnotation
            {  HorizontalValue = somePointX,//DateTime
                VerticalValue=.somePointY,
                Content =  triangle
            } );
As the below figure shows, the problem is  when I changed the chart's zoom, the shape size does not change, actually I want the vertexes of triangles sticks to their initial coordinates, and triangle resize itself with changing zoom.

Peshito
Telerik team
 answered on 23 Jan 2014
5 answers
356 views
I'm trying to dynamically adjust the tick marks and labels on a RadCartesianChart using MajorTickInterval and LabelInterval when zooming to maintain an acceptable look. However, the chart does not maintain the specified MajorTickInterval when zooming, and I haven't been able to figure out the specifics of the behavior to adjust accordingly.

Here's a simple example to illustrate.

XAML:
<Window x:Class="ZoomMajorTickInterval.MainWindow"
        Title="MainWindow" Height="350" Width="1280">
    <Grid>
        <telerik:RadCartesianChart x:Name="Chart">
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY" />
            </telerik:RadCartesianChart.Grid>
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis LabelFitMode="Rotate" />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis/>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior ZoomMode="Both" PanMode="Both" />
            </telerik:RadCartesianChart.Behaviors>
            <telerik:RadCartesianChart.Series>
                <telerik:LineSeries ItemsSource="{Binding MyData}" CategoryBinding="PeriodText" ValueBinding="DataValue" />
            </telerik:RadCartesianChart.Series>
        </telerik:RadCartesianChart>
    </Grid>
</Window>

Code-behind:
using System;
using System.Windows;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.ChartView;
namespace ZoomMajorTickInterval
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Random r = new Random();
            MyData = new ObservableCollection<DataPoint>();
            for (int ctr = 0; ctr < 500; ctr++)
                MyData.Add(new DataPoint() { PeriodText = "Q" + ctr.ToString(), DataValue = r.Next(1000) });
            DataContext = this;
            CategoricalAxis axis = Chart.HorizontalAxis as CategoricalAxis;
            axis.MajorTickInterval = 5;
            Chart.HorizontalAxis.LabelInterval = 2;
        }
        public ObservableCollection<DataPoint> MyData { get; set; }
    }
    public class DataPoint
    {
        public string PeriodText {get; set;}
        public int DataValue { get; set; }
    }
}

Run the example and notice that initially it correctly renders major ticks every 5 data points, and labels every 2 major ticks, just as specified in the code. This displays 50 labels. Now move the max zoom slider on the horizontal axis back to about the 2/3 mark and the axis shifts from using 5 points between major ticks to 2. The labels continue to show every 2 major ticks, so now it is displaying 81 labels, which is much more crowded than desired (even more-so in my real application).

Even more problematically, the value of MajorTickInterval remains 5 even though the display has changed, so I have no way to re-calculate the LabelInterval appropriately to maintain the number of labels I want.

Is this a bug, or is there an algorithm at work here? If the latter, how can I determine what the interval actually is to adjust the labels correctly?

I'm using the 2013 1204 build.

Thanks,
Louis


										
Pavel R. Pavlov
Telerik team
 answered on 23 Jan 2014
1 answer
327 views
Hi,

I have a little problem

My gridview bind to a Observable collection and work well.
I would add a column wich contains a specific usercontrol and the binding is a List<MyViewModel> but it doesn't.
The datacontext of my control is ever null.

the XAML :
<telerik:RadGridView Name="RadGridView" Grid.Row="1" ItemsSource="{Binding Path=Documents}" DataLoadMode="Asynchronous" AutoGenerateColumns="False" SelectionMode="Single" CanUserDeleteRows="False" CanUserInsertRows="False">
<telerik:RadGridView.Columns>
...
<telerik:GridViewDataColumn IsReadOnly="True" Header="Fichier(s) joint(s)" DataMemberBinding="{Binding Files}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<control:UserControl1 DataContext="{Binding Files}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
...
</telerik:RadGridView>
Dimitrina
Telerik team
 answered on 23 Jan 2014
2 answers
128 views
I am adding columns to a grid programmatically as the number of columns can vary.  Additionally I want to sum the column values in the column footer.  The following code is used to achieve this;

Private Sub AddContractYearColumns()
    Dim sPeriod As String = String.Empty
    Dim iIndex As Integer = 0
 
    Try
        Dim Years = From Yrs In gdcRAD.vw_ProjectYears Select Yrs.Year
 
        For Each Yr As String In Years
            If Yr.ToInteger >= Year(Date.Today) Then
                iIndex += 1
                sPeriod = "Period" & iIndex.ToString("00")
 
                Dim column As New GridViewDataColumn()
 
                With column
                    .Header = Yr
                    .UniqueName = Yr
                    .DataMemberBinding = New Binding(sPeriod)
                    .DataFormatString = "0.00"
                    .TextAlignment = TextAlignment.Right
                End With
 
                gvContractYrs.Columns.Add(column)
 
                Dim f As New Telerik.Windows.Data.SumFunction
                f.SourceField = sPeriod
                gvContractYrs.Columns(Yr).AggregateFunctions.Add(f)
            End If
        Next
    Catch ex As Exception
        Throw New RadException("Add Contract Year Columns", ex.Message, ex.InnerException)
    End Try
End Sub

This creates columns with headings such as "2014", "2015", etc that are bound to "Period01", "Period02", etc.

The following code is then used to to obtain and bind the data to the grid;

Private Sub DisplayAvailableEquipYrs()
    Try
        Dim EquipList = (From Equipment In gdcRAD.usp_YearsAvailable(Date.Today, False, False) Select Equipment).ToList
        gvContractYrs.ItemsSource = EquipList
 
    Catch ex As Exception
        Throw New RadException("Display Available Equipment Years", ex.Message, ex.InnerException)
    End Try
End Sub

The EquipList is populated correctly with a nullable Double data type being returned for "Period01", "Period02", etc however I get the error "No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments." when I attempt to bind the EquipList object to the ItemsSource.

Could the nullable data type be causing the problem?
Yoan
Telerik team
 answered on 23 Jan 2014
1 answer
94 views
In the grid, is there a way to implement the CTRL + C function via a Menu click. I want when the user right clicks the grid and selects Copy to copy the selected records like it would do if the user presses CTRL + C
Yoan
Telerik team
 answered on 23 Jan 2014
2 answers
132 views

Hi,


I implemented a sortable collection to use like itemssource for my RadTreeview. Each item is editable and when item is validated the sortable collection sort well the item. Normal behavior would be

1 User start edit the item

2 User enter Enter key

3 Item is validated

4 Item is sorted in sortablecollection and RadTreeView is updated. IsInEditMode is false.



All works fine except if i decide to bind the IsInEditMode with a property of my model. When the IsInEditMode is binding (Mode TwoWay) the user must press twice Enter to complete the edit.



I join a sample here.



If you launch the sample and try to rename the 7ABC item in 0AAA, the item is well move to first position but stay in editmode. If you comment the following  line in MainWindow.xaml

<Setter Property="IsInEditMode" Value="{Binding IsInEditMode,Mode=TwoWay}"/>
the item is well move and exit from editmode when press Enter.



I don't understand why the binding on IsInEditMode interfer with edition.



Regards

Luc

luc
Top achievements
Rank 1
 answered on 22 Jan 2014
3 answers
206 views

Hi Telerik Teams,

Please help me on one issue with loading values slider in Slider. When i load the slider with DoubleCollection I get an error .The project is done in Visual studio 2008. I lost lots of time for troubleshooting.But i cant solve this error. Please help me. 

The error is "Specified element is already the logical child of another element. Disconnect it first. in using canvas".

I mention below  the code that  implemented in the project for loading the Slider. 
----------------------------------------------------------------------------------------------------------------------------------------------

            ParentCanvas = New Canvas()
            ParentCanvas.ClipToBounds = True
            ParentCanvas.Width = 1200
            ParentCanvas.Height = 800
           
            Dim ValText As String
            Dim Valcode As Integer
            Dim tickcollection As New DoubleCollection()
            Dim canvas30 As New Canvas()
            If canvas30 IsNot Nothing Then
                canvas30.Children.Remove(RadSlider1)
            End If
            For i As Integer = 0 To alItemSource.Count
                Dim pInfo As TWBS.UI.B1.DashBoards.PlotInfo = alItemSource(i)
                ValText = pInfo.LegendLabel
                Dim dictionary As New Dictionary(Of String, Integer)
                dictionary.Add(ValText, i)
                Valcode = dictionary.Item(ValText)
                tickcollection.Add(Valcode)
                RadSlider1.Ticks = tickcollection
                RadSlider1.TickPlacement = Telerik.Windows.Controls.TickPlacement.BottomRight

                canvas30.Children.Add(RadSlider1)
                ParentCanvas.Children.Add(canvas30)
            Next
The Bolded code is the place where i get the error.Its urgent.please help me.......

Pavel R. Pavlov
Telerik team
 answered on 22 Jan 2014
1 answer
144 views
I want to implement my custom Command. So, I derived from IImageCommand and implement execute Method. And then, call my command from XAML code. But, when I run my application nothing is happened.
This is an example of what I have implemented :
public class MyCustomCommand : IImageCommand
    {
        public Telerik.Windows.Media.Imaging.RadBitmap Execute(Telerik.Windows.Media.Imaging.RadBitmap source, object context)
        {
            //My code here ....
        }
    }
and in my XAML file :
<telerik:ImageToolItem ImageKey="Custom" Text="Custom Command" Command="{Binding MyCustomCommand}"/>
Thank you very much for your responses. And it will be very helpful if there is an example showing how to create custom commands.

My warmest regards.
Bacem

Petya
Telerik team
 answered on 22 Jan 2014
1 answer
295 views
A few months ago I created a boxplot chart using a slightly modified version of the method outlined here: http://www.telerik.com/help/wpf/radchart-howto-create-scatter-errorbars-and-boxplot-series.html

I added the following to the chart's XAML: 

<telerik:RadCartesianChart.Behaviors>
   <telerik:ChartPanAndZoomBehavior ZoomMode="Vertical" PanMode="Vertical"/>
   <telerik:ChartSelectionBehavior DataPointSelectionMode="Single" />
   <telerik:ChartSelectionBehavior SelectionChanged="SelectionChanged" />
</telerik:RadCartesianChart.Behaviors>
At the time this worked perfectly and the SelectionChanged event fired and executed as I wanted. 

While revisiting this code recently I found that the event no longer fires and I've spent quite some time looking through my own code to see if any of my changes could have caused this but have not been able to get the event firing again. However in the intervening time since this was last known to work I updated my Telerik version to 2013.3.1204.40. Are there any known issues in this version which could cause the SelectionChanged event to stop firing?

Thanks for the help,

Andy.
Martin Ivanov
Telerik team
 answered on 22 Jan 2014
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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?