Telerik Forums
UI for WPF Forum
2 answers
117 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
87 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
122 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
197 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
136 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
285 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
3 answers
255 views

I have a Cartesian chart with DateTimeCategoricalAxis.
1- I want  a free space added at the end of the horizontal axis, and extends it beyond the maximum date which now available on the horizontal chart.

2 Every time the chart is initialized, it previews entire data! Is there a way to show only the last 50 data points at first time initialization of chart?

 

 

 

 

 

Pavel R. Pavlov
Telerik team
 answered on 22 Jan 2014
1 answer
120 views
The following post describes a way to asynchronously load distinct filter items:

http://blogs.telerik.com/vladimirenchev/posts/10-01-07/how-to-populate-radgridview-for-silverlight-distinct-filters-asynchronously-using-wcf-ria-services.aspx

I was able to get my code to work with this method (using a thread to retrieve the items from the DB and adding the result to the collection), but I wonder if there is any better/easier/cleaner way of doing it? The caveat with my current implementation is that I have to manually terminate the long-running thread whenever it becomes redundant (for example, when filter window closes, or when the whole grid is closed etc). 

Any idea/recommendation is appreciated. Thanks in advance.
Dimitrina
Telerik team
 answered on 22 Jan 2014
3 answers
92 views
I am having issue where a user pastes item like text or image from external application into a diagram.

When the user does this it adds an item to the diagram with text saying "Telerik.Windows.Controls.Diagram.Extensions.ViewModels.NodeViewModelBase".

How can I handle the paste action so it only pastes items onto the diagram that are valid Telerik diagram items?
And maybe allow pasted text from other applications but not anything else like images?
Pavel R. Pavlov
Telerik team
 answered on 22 Jan 2014
1 answer
269 views
How can I do the same thing of building a BrushCollection and assigning to RadStackedDataBar programmatically in code behind. Thanks for answers.

<telerik:RadStackedDataBar
    Name="xStackedDataBar"
    Grid.Row="1"
    Grid.Column="1"
    Minimum="-20"
    Maximum="20"
    ValuePath="BarValue"
    ToolTipPath="ToolTipItem"
    Margin="10,5">
    <telerik:RadStackedDataBar.BarBrushes>
        <databars:BrushCollection>
          <SolidColorBrush Color="SlateBlue" />
          <SolidColorBrush Color="AntiqueWhite" />
          <SolidColorBrush Color="Aqua" />
          <SolidColorBrush Color="Green" />
          <SolidColorBrush Color="Blue" />
 
        </databars:BrushCollection>
    </telerik:RadStackedDataBar.BarBrushes>
</telerik:RadStackedDataBar>

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
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
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?