Telerik Forums
UI for WPF Forum
6 answers
199 views
I'm facing this weird issue of the appoint filter not working the second time around.

My Application has calendars for different users.

When I first load the scheudle view (calendar) and try to filter it all works well. But then when I try to change the calendar for another user and then apply filter on it, nothing seems to happen. 

When I debugged, I realised that the predicate does hit all the time the filter is supposed to be called. But the second time around the predicate doesn't call the filter appointment method at all. I'm puzzled as to why this happens and need you to help me. 

As a background, I've bound the predicate (FilteredAppointments) to the appointment filter property in the xaml and the predicate then calls the filter appointment method (which returns a bool for each appointment). Also, all these are in separate classes, i.e. the predicate and the filterAppointments method.

Please help, need to resolve this ASAP.
Miroslav Nedyalkov
Telerik team
 answered on 09 May 2013
1 answer
621 views
Hi,

There is GridView with some columns and want to display total of one of the column which is having data of type System.Double. I had look at the same and tried to implement the same but it didn't work and end-up with following exception.

Code
<telerik:GridViewDataColumn DataMemberBinding="{Binding TravelRate, StringFormat=c}"
                                            UniqueName="TravelRate"
                                            Header="Travel Rate"
                                            MinWidth="100">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction Caption="Sum: "
                                             ResultFormatString="{}{0:c}"
                                             SourceField="UnitPrice" />
                    </telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>

Exception
No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

I also had a look at another post where it's mentioned create custom aggregation function. I tried it but didn't get any success.

Code
public class SumFunction : EnumerableSelectorAggregateFunction
    {
        protected override string AggregateMethodName
        {
            get { return "Sum"; }
        }

        protected override Type ExtensionMethodsType
        {
            get
            {
                return typeof(Amounts);
            }
        }
    }

    public static class Amounts
    {
        public static Double Sum<T>(IEnumerable<T> source, Func<T, Double> selector)
        {
            return source.Select(selector).Aggregate(Double.Parse("0"), (t1, t2) => t1 + t2);
        }
    }

Can please some one help me with this?

Thanks.

Yoan
Telerik team
 answered on 09 May 2013
24 answers
861 views
Is there a way to customize the Enum dropdown list for a field?  We have different permission settings for our applications, and we have to limit options for some users.  An Example would be to have the following code:

Enum Produce
Apples
Oranges
Pears
Peaches
End Enum

Where we can set the 'Produce' field for some users to be able to see and select Apples and Oranges only, while others can  see and select the full list.

I have been directed to this article: http://www.telerik.com/help/wpf/radcombobox-howto-enable-disable-radcombobox-items.html, but that deals with setting it up with Xaml.  I need to change the list on the fly at runtime, and have accessed the RadComboBox with this line of code:

ComboBoxItems = RadPropertyGrid1.ChildrenOfType(Of RadComboBox)()

But now that I have it, how can I manipulate the list?  I have autobinding on, so when I try to clear or set the items manually, I get the error:

"Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."

Maya
Telerik team
 answered on 08 May 2013
2 answers
114 views
Hello,
we are facinga big problem with radchart performance. when we are plotting the graph with around 1000 rows in local enviroment it takes about 4-5 seconds , but when i deploy the same application on server it takes around 45-50 seconds to plot the graph .


Please, could you provide any help for this?

Thanks.

Ankur
 
Petar Kirov
Telerik team
 answered on 08 May 2013
3 answers
306 views

I have a template selector that I would like to work with the RadPanelBarItem items presenter. Unfortunatley the template is never called. I am doing the following:

<telerik:RadPanelBar Grid.Row="1" x:Name="PART_RAD_PANEL_BAR" Margin="5,5,0,0" ItemsSource="{Binding UpdateSourceTrigger=PropertyChanged, Path=ExperimentCollection.ExperimentTriggerCollection, NotifyOnSourceUpdated=True}" >             
</telerik:RadPanelBar>

And am using the following Style for the RadPanelBarItem (Cut for brevity)

<Style x:Key="PanelBarItemKey" TargetType="{x:Type telerik:RadPanelBarItem}">
    <Setter Property="Background">
        <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1"
                                 StartPoint="0.5,0">
                <GradientStop Color="White" />
                <GradientStop Color="Gainsboro"
                              Offset="0.43" />
                <GradientStop Color="#FFADADAD"
                              Offset="0.44" />
                <GradientStop Color="#FFD4D4D4"
                              Offset="1" />
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
    <Setter Property="BorderBrush"
            Value="#FF848484" />
    <Setter Property="BorderThickness"
            Value="1" />
    <Setter Property="Foreground"
            Value="Black" />
    <Setter Property="Padding"
            Value="3" />
    <Setter Property="HorizontalContentAlignment"
            Value="Stretch" />
    <Setter Property="VerticalContentAlignment"
            Value="Stretch" />
    <Setter Property="HeaderTemplate"
            Value="{StaticResource PanelBarItemTemplate}" />
    <Setter Property="ItemsSource"
            Value="{Binding SelectedTrigger}" />
    <Setter Property="ItemTemplateSelector"
            Value="{StaticResource TriggerTemplateSelectorKey}" />
    <Setter Property="ChildItemsTemplate">


And the following Template Selector:

Public Class TriggerTemplateSelector
    Inherits DataTemplateSelector
 
    Public Overrides Function SelectTemplate(ByVal item As Object, ByVal container As DependencyObject) As DataTemplate
 
        If item IsNot Nothing Then
 
            Dim et As ExperimentTrigger = CType(item, ExperimentTrigger)
 
            Dim element As FrameworkElement
            element = TryCast(container, FrameworkElement)
 
            Select Case et.TriggerType
                Case "Timer"
                    Return TryCast(element.FindResource("TimerTriggerTemplate"), DataTemplate)
                Case "Damage"
                    Return TryCast(element.FindResource("TriggerDamageTemplate"), DataTemplate)
                Case "IED Detonation"
                    Return TryCast(element.FindResource("TriggerDetonationTemplate"), DataTemplate)
            End Select
 
        Else
            Return Nothing
        End If
 
        Return Nothing
 
    End Function
End Class

The Items in the RadPanelBarItems need to call the template selector which I thought would be called by setting the ItemTemplateSelector in the Style, but this does not seem to be the case. How can I call my template selector in the RadPanelBarItem Style?

I am using the following to link to further illustrate.

If I do the following in XAML the template selector is called but I don't know how many RadPabelBarItems I will have:

<telerik:RadPanelBar Grid.Row="1"
                     Margin="5,5,0,0"
                     >
 
    <telerik:RadPanelBarItem Header="Test"
                             Style="{x:Null}"
                             ItemTemplateSelector="{StaticResource TriggerTemplateSelectorKey}"
                             ItemsSource="{Binding UpdateSourceTrigger=PropertyChanged, Path=ExperimentCollection.ExperimentTriggerCollection, NotifyOnSourceUpdated=True}" />
</telerik:RadPanelBar>


I have not had any luck with this so I am currently trying to do it procedurally. Is this possible to do this in XAML?

Regards,
Joseph

Tina Stancheva
Telerik team
 answered on 08 May 2013
6 answers
426 views
Hello

When I open a PDF using the "Open" button on the radtoolbar, I'd like to get the path of the selected PDF.  What's the best way to do this?  It would also work to pull this as a property from the pdfdocumentsource object etc. if available.

Thanks
Mark
Mark
Top achievements
Rank 1
 answered on 08 May 2013
2 answers
183 views
Hello,

In my RadGridView I have a field "Fruits" which is a comma separated string such as "apple, orange, banana". When I group on Fruits, the groups are created based on the string value in the Fruits .. What I want is  separate group for each value in the Fruits column .. Is there a way I can achieve this? I saw examples of CustomGroupDescriptors, will that help me achieve this functionality?

Thanks.
Rossen Hristov
Telerik team
 answered on 08 May 2013
1 answer
487 views

<telerik:GridViewDataColumn DataFormatString="N0" DataMemberBinding="{Binding MyValue}" Header="{Binding MyLabel, StringFormat=This {0}}" />

"This " is not shown in my header. What am I doing wrong?
Dimitrina
Telerik team
 answered on 08 May 2013
2 answers
235 views
Hi I am using the DataGrid with UI virtualization enabled.
In XAML the main attributes set on the Grid are:
EnableRowVirtualization="True"
ScrollMode="Deferred"
SelectionMode="Extended"

The grid binds to a VirtualQueryableCollection that makes uses of the ItemsLoading event to load data into the VirtualQueryableCollectionView.
So a queryable is not passed in as a constructor.

The Grid is working fine except for when I want to call Grid.SelectedItems.Clear().

I am manually populating the Grid.SelectedItems with the correct rows that should be selected.

The Grid has 240,000 rows. I select a few rows at the top to the grid.
Then I scroll down the bottom of the grid.
At the bottom I add another row to the selection, so Grid.SelectedItems has 3 items in it. Everything is fine.
A call is made to Grid.SelectedItems.Clear().
The process freezes and eventually a Stackoverflow exception is thrown.
The stacktrace does not show much. Throughout the trace a call to VirtualQueryableCollection.Load() is occurring for the whole list in increments of the LoadSize (100).

This is with version:
2013.1.022.0.40

If I try version
2012.3.1129.40
The process does not have a Stackoverflow exception but is stuck in a loop and does not return.

If I select items at the top of the grid only, it works fine. And if I select items at the bottom of the grid it works fine.

The machine I work on is not connected to the internet but I may be able to provide the stacktrace if needed.
Yordanka
Telerik team
 answered on 08 May 2013
1 answer
490 views
Hi all.

I need to sync position and width for two RadCartesianChart's.

XAML:

style definition for chart's:           
<Style x:Key="ChartStyle" TargetType="telerik:RadCartesianChart">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type telerik:RadChartBase}">
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                <Grid>
                                    <ContentPresenter x:Name="emptyContent"
                                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                      Content="{TemplateBinding EmptyContent}"
                                                      ContentTemplate="{TemplateBinding EmptyContentTemplate}"
                                                      IsHitTestVisible="False"
                                                      Visibility="Collapsed" />
                                    <Canvas x:Name="adornerContainer"
                                            HorizontalAlignment="Stretch"
                                            VerticalAlignment="Stretch"
                                            Background="Transparent">
                                        <Canvas x:Name="labelContainer"
                                                HorizontalAlignment="Stretch"
                                                VerticalAlignment="Stretch">
                                            <Canvas x:Name="renderSurface"
                                                    HorizontalAlignment="Stretch"
                                                    VerticalAlignment="Stretch">
                                                <Border x:Name="plotAreaDecoration" Style="{TemplateBinding PlotAreaStyle}" />
                                            </Canvas>
                                        </Canvas>
                                    </Canvas>
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

chart #1:
<telerik:RadCartesianChart x:Name="DeviationChart"
                                               Grid.Row="1"
                                               HorizontalAlignment="Stretch"
                                               VerticalAlignment="Stretch"
                                               MaxZoom="{Binding MaxZoom}"
                                               MouseMove="Chart_OnMouseMove"
                                               PanOffset="{Binding PanOffset,
                                                                   Mode=TwoWay}"
                                               Style="{StaticResource ChartStyle}"
                                               Zoom="{Binding Zoom,
                                                              Mode=TwoWay}">
 
                        <telerik:ScatterAreaSeries x:Name="DeviationSeries"
                                                   Fill="{Binding DeviationFillColor}"
                                                   ItemsSource="{Binding DeviationPoints}"
                                                   Opacity="{Binding DeviationOpacity}"
                                                   Stroke="{Binding DeviationColor}"
                                                   StrokeMode="AllButPlotLine"
                                                   StrokeThickness="{Binding DeviationThickness}"
                                                   Tag="{Binding Path=Settings.PressureEU,
                                                                 Converter={StaticResource PressureEUConverter}}"
                                                   XValueBinding="X"
                                                   YValueBinding="Y">                           
                        </telerik:ScatterAreaSeries>
  <!-- ... -->
                        <telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:LinearAxis x:Name="DeviationChartHorizontalAxis"
                                                MajorTickStyle="{StaticResource TopChartTickStyle}"
                                                Maximum="{Binding Path=ChartSettings.ChartMaxX}"
                                                Minimum="{Binding Path=ChartSettings.ChartMinX}"
                                                ShowLabels="False"
                                                Visibility="Collapsed" />
                        </telerik:RadCartesianChart.HorizontalAxis>
 
                        <telerik:RadCartesianChart.VerticalAxis>
                            <telerik:LinearAxis x:Name="DeviationChartVerticalAxis"
                                                Title="{Binding Path=PressureBaseEUText}"
                                                LabelFormat="N2"
                                                LastLabelVisibility="Visible"
                                                Maximum="{Binding DeviationChartSettings.ChartMaxY}"
                                                Minimum="{Binding DeviationChartSettings.ChartMinY}"
                                                Style="{StaticResource LinearAxisStyle}" />
                        </telerik:RadCartesianChart.VerticalAxis>
 
                        <telerik:RadCartesianChart.Grid>
                            <telerik:CartesianChartGrid MajorXLinesRenderMode="All"
                                                        MajorYLinesRenderMode="All"
                                                        StripLinesVisibility="None"
                                                        Style="{StaticResource CartesianChartGridStyle}" />
                        </telerik:RadCartesianChart.Grid>
 
                        <telerik:RadCartesianChart.Behaviors>
                            <telerik:ChartPanAndZoomBehavior PanMode="Both" ZoomMode="Both" />
                            <telerik:ChartTrackBallBehavior ShowIntersectionPoints="False"
                                                            ShowTrackInfo="True"
                                                            SnapMode="None" />
                        </telerik:RadCartesianChart.Behaviors>
 
                    </telerik:RadCartesianChart>


chart #2:
<telerik:RadCartesianChart x:Name="Chart"
                                           Grid.Row="1"
                                           MaxZoom="{Binding MaxZoom}"
                                           MouseMove="Chart_OnMouseMove"
                                           PanOffset="{Binding PanOffset,
                                                               Mode=TwoWay}"
                                           Style="{StaticResource ChartStyle}"
                                           Zoom="{Binding Zoom,
                                                          Mode=TwoWay}">
 
                    <telerik:ScatterAreaSeries x:Name="ElevationSeries"
                                               Fill="{Binding ElevationFillColor}"
                                               ItemsSource="{Binding RealElevationsPoints}"
                                               Opacity="{Binding ElevationOpacity}"
                                               Stroke="{Binding ElevationColor}"
                                               StrokeMode="AllButPlotLine"
                                               StrokeThickness="{Binding ElevationThickness}"
                                               XValueBinding="X"
                                               YValueBinding="Y">
                        <telerik:ScatterLineSeries.LegendSettings>
                            <telerik:SeriesLegendSettings Title="{Binding ElevationDescription}" />
                        </telerik:ScatterLineSeries.LegendSettings>
  <!-- ... -->
                        <telerik:ScatterLineSeries.TrackBallInfoTemplate>
                            <DataTemplate>
                                <Border Background="#FFEBEBEB">
                                    <TextBlock Text="{Binding Path=DataPoint.XValue, StringFormat=\{0:N3\}}" />
                                </Border>
                            </DataTemplate>
                        </telerik:ScatterLineSeries.TrackBallInfoTemplate>
                    </telerik:ScatterAreaSeries>
 
                    <telerik:RadCartesianChart.HorizontalAxis>
                        <telerik:LinearAxis x:Name="ChartHorizontalAxis"
                                            LabelFormat="N0"
                                            Maximum="{Binding Path=ChartSettings.ChartMaxX}"
                                            Minimum="{Binding Path=ChartSettings.ChartMinX}"
                                            Style="{StaticResource LinearAxisStyle}" />
                    </telerik:RadCartesianChart.HorizontalAxis>
 
                    <telerik:RadCartesianChart.VerticalAxis>
                        <telerik:LinearAxis x:Name="ChartVerticalAxis"
                                            HorizontalLocation="Left"
                                            LabelFormat="N2"
                                            Maximum="{Binding ChartSettings.ChartMaxY}"
                                            Minimum="{Binding ChartSettings.ChartMinY}"
                                            Style="{StaticResource LinearAxisStyle}" />
                    </telerik:RadCartesianChart.VerticalAxis>
 
                    <telerik:RadCartesianChart.Grid>
                        <telerik:CartesianChartGrid MajorXLinesRenderMode="All"
                                                    MajorYLinesRenderMode="All"
                                                    StripLinesVisibility="None"
                                                    Style="{StaticResource CartesianChartGridStyle}" />
                    </telerik:RadCartesianChart.Grid>
 
                    <telerik:RadCartesianChart.Behaviors>
                        <telerik:ChartPanAndZoomBehavior PanMode="Both" ZoomMode="Both" />
                        <telerik:ChartTrackBallBehavior ShowIntersectionPoints="False"
                                                        ShowTrackInfo="True"
                                                        SnapMode="None" />
                    </telerik:RadCartesianChart.Behaviors>
 
                </telerik:RadCartesianChart>

Code:
public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
 
            if (!Chart.IsTemplateApplied) Chart.ApplyTemplate();
            if (!DeviationChart.IsTemplateApplied) DeviationChart.ApplyTemplate();
 
            var chartpad = Chart.Template.FindName("plotAreaDecoration", Chart) as Border;
            var deviationpad = DeviationChart.Template.FindName("plotAreaDecoration", DeviationChart) as Border;
 
            if (null != chartpad && null != deviationpad)
            {
                chartpad.SizeChanged += (sender, args) =>
                    {
                        // Set position of left edge of chart #1 relative to chart #2
                        object left = chartpad.GetValue(Canvas.LeftProperty);
                        deviationpad.SetValue(Canvas.LeftProperty, left);
                        // Set width of chart #1 relative to chart #2
                        object width = chartpad.GetValue(WidthProperty);
                        deviationpad.SetValue(WidthProperty, width);
                    };
            }
        }
But this doesn't work. Any ideas? Best regards, George.
Petar Marchev
Telerik team
 answered on 08 May 2013
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?