Telerik Forums
UI for WPF Forum
5 answers
410 views

Hi,

I'm trying to use NestedProperties feature with CustomTypeDescriptor and custom PropertyDescriptor, but the autogenerated PropertyDefinition does not have NestedProperties and HasNestedProperties is false:

void AutoGeneratingPropertyDefinition(object sender, AutoGeneratingPropertyDefinitionEventArgs e)
    {
       
      var descriptor = e.PropertyDefinition.SourceProperty.Descriptor as PropertyDescriptor;
      if (descriptor != null)
      {
          //e.PropertyDefinition.NestedProperties.Count == 0
          //but descriptor.GetChildProperties().Count > 0
             //why?
       }
    }

in my scenario:

  • I set AutoGenerateProperties = true and NestedPropertiesVisibility = true;
  • I have class MyCustomObject which implements ICustomTypeDescriptor (namespace System.ComponentModel)
  • I have class CustomPropertyDesctriptor that inherits from PropertyDescriptor (namespace System.ComponentModel)
  • ICustomTypeDescriptor.GetProperties implementation on MyCustomObject returns a collection of CustomPropertyDescriptor.
    Sometimes CustomPropertyDescriptor.GetValue(object component) returns new MyCustomObject instance so I have tree hierarchy

What's the condtition I need to satisfy to autogenerate NestedProperties' PropertyDefinitions?

it is not so easy to create sample project to simulate my scenario but I can do that if you can't answer without it

Stefan
Telerik team
 answered on 05 Sep 2016
1 answer
186 views

Hi folks,

i tried to cancel the editation of a ComboBoxColumnCell. But when i set GridViewPreparingCellForEditEventArgs.Cancel to true, the cell gets in edit mode, too.

Is it a bug or do i have to set another property?

Thanks

 

David

Stefan
Telerik team
 answered on 05 Sep 2016
2 answers
189 views

I had a RadCartesianChart control with a LineSeries within, which amtrying to replace with an AreaSeries. And following is the new code I have:

<telerik:RadCartesianChart Name="outputChart" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY">
                    <telerik:CartesianChartGrid.MajorXLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Shape.Stroke" Value="{StaticResource gridLineColor}" />
                        </Style>
                    </telerik:CartesianChartGrid.MajorXLineStyle>
                    <telerik:CartesianChartGrid.MajorYLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Shape.Stroke" Value="{StaticResource gridLineColor}" />
                        </Style>
                    </telerik:CartesianChartGrid.MajorYLineStyle>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
 
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeContinuousAxis
                    Name="horizontalAxis"
                    HorizontalAlignment="Center"
                    HorizontalContentAlignment="Center"
                    ElementBrush="LightGray"
                    PlotMode="OnTicks"
                    LabelInterval="2"
                    LabelStyle="{StaticResource XAxisLabelStyle}"
                    MajorStepUnit="Minute"
                    FontSize="12"
                    Foreground="{StaticResource textForeground}"
                    LabelFormat="h:mm tt"
                    LineThickness="0"
                    Minimum="{Binding StartTime}"
                    Maximum="{Binding EndTime}"
                    MajorStep="{Binding HorizontalMajorStep}" />
            </telerik:RadCartesianChart.HorizontalAxis>
 
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis
                    Name="verticalAxis"
                    Title="{x:Static resources:Strings.VerticalAxisTitle}"
                    ElementBrush="LightGray"
                    Minimum="0"
                    Maximum="{Binding VerticalMax}"
                    LineThickness="0"
                    MajorStep="{Binding VerticalMajorStep}" />
            </telerik:RadCartesianChart.VerticalAxis>
 
            <telerik:RadCartesianChart.Series>
                <telerik:AreaSeries
                Name="combinedSeries"
                ItemsSource="{Binding ChartPoints}"
                ValueBinding="Combined"
                CategoryBinding="CalculationTime"
                StrokeThickness="2"
                Stroke="{StaticResource StrokeColor}"
                ClipToPlotArea="False"
                Visibility="{Binding ThroughputVisibility}">
                    <telerik:AreaSeries.AreaShapeStyle>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="{StaticResource StrokeColor}" />
                            <Setter Property="Opacity" Value="0.2" />
                        </Style>
                    </telerik:AreaSeries.AreaShapeStyle>
                </telerik:AreaSeries>
            </telerik:RadCartesianChart.Series>
 
            <telerik:RadCartesianChart.Annotations>
                <telerik:CartesianGridLineAnnotation
                    Name="combinedWarningLevelAnnotation"
                    Axis="{Binding ElementName=verticalAxis}"
                    Value="{Binding CombinedThroughputWarningLevel}"
                    Label="{Binding CombinedThroughputWarningLevel}"
                    Foreground="{StaticResource textForeground}"
                    FontSize="9"
                    Visibility="{Binding CombinedThroughputVisibility}"
                    StrokeThickness="1"
                    Stroke="{StaticResource combinedThroughputColor}" />
            </telerik:RadCartesianChart.Annotations>
        </telerik:RadCartesianChart>

 The vertical bound for the chart is dynamically bound to VerticalMax which is calculated at each time step after determining if any data value being plotted is above the current vertical limit. This logic was working perfectly well with LineSeries and the moment I replaced it with AreaSeries, the graph lines started going outside the vertical limits (i.e below 0 and above vertical max of the chart). There has been no change in the data being fed in whatsoever. Is there anything else I should be doing while using AreaSeries?

Martin Ivanov
Telerik team
 answered on 05 Sep 2016
3 answers
312 views

I've found the code to override the template selection:DataTemplateSelector

But the collapsed state of the combobox is not working.

Here is the XAML:
<telerik:RadComboBox x:Name="cboPickups"
Command="{Binding PickupChangedCommand}" HorizontalAlignment="Stretch"
CommandParameter="{Binding ElementName=cboPickups,Path=SelectedItem}" IsEnabled="{Binding CanSelectPickup}"
ItemsSource="{Binding Pickups}"
SelectedValuePath="CustomerId" SelectedValue="{Binding Path=SelectedPickup.Id, Mode=OneWay}" Margin="4">
<telerik:RadComboBox.ItemTemplateSelector>
<Helpers:CustomerComboTemplateSelector />
</telerik:RadComboBox.ItemTemplateSelector>
</telerik:RadComboBox>

Here are the templates:
<DataTemplate x:Key="CustomerComboCollapsed">
    <TextBlock Text="{Binding CompanyName}" />
</DataTemplate>
 
<DataTemplate x:Key="CustomerComboExpanded">
    <StackPanel>
        <TextBlock Text="{Binding CompanyName}" />
        <TextBlock Text="{Binding CityState}" />
    </StackPanel>
</DataTemplate>

Here is the template selector class:
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
    var presenter = (ContentPresenter) container;
 
    if (presenter != null && item != null)
    {
        if (presenter.TemplatedParent is ComboBox)
        {
            return presenter.FindResource("CustomerComboCollapsed") as DataTemplate;
        }
        else
        {
            return presenter.FindResource("CustomerComboExpanded") as DataTemplate;
        }
 
    }
    return null;
}

But when the window initializes and it tries to load the ComboBox, the "container" is null.

So it's trying to assign the collapsed template, but for some reason the container is null. Any ideas?  I've narrowed it down to the RadComboBox.  If I replace it with the base ComboBox control it works fine.

I've attached the screen shots for the collapsed/expanded and the debugger.

Thanks,
-Sid.

Piotr
Top achievements
Rank 1
 answered on 04 Sep 2016
2 answers
116 views

Background:

Our applications have multiple maps. I tried using one map control and moving it around to whichever screen was active but that was impractical.
I also tried creating a shared list of providers amongst the map controls, but that just didn't work.

Problem:
Each map has to create its own Bing provider so each map is creating its own session. If I have 10 maps, then my application is using 10x the amount of billable transactions than it should be every time it's opened. Is it possible to "share" sessions? For example, the first provider to be created could get the session and then I could just set the other providers to use the same session ID manually?

I think I can test this but wanted to know if there any problems with doing this.

Jason D
Top achievements
Rank 1
Veteran
 answered on 02 Sep 2016
2 answers
222 views

I'm currently in a heavy need of the GanttView control, but having some minor & major problems.

Major Problem

See Picture Bug_1 -> Bug_2

In Bug1 you see how the control initializes with the columns packed together very close and behind the GanttView. On Bug2 you see what happens, as soon as i use the horizontal scrollbar beneath the columns. Is there any real workaround for this behavior?

Minor Problem

See Picture Problem_Splitter and Spacing

1) The orange highlighted Splitter. How can I access this and set it to a specific size? (I need to adjust the splitter so, table view and chart view are both exactly 50% regardless of width of window)

2) The green highlighted Space. This is a space the control uses because of HorizontalAlignment="stretch" but not really. I want the GanttView to behave as every other control when on Stretch mode -> use the whole space available. Any solution/workaround for this?

 

tia

Mark

Polya
Telerik team
 answered on 02 Sep 2016
2 answers
110 views

Hi,

I would like to know if there is a property to get the column filter back in text format.

for example if I set the filter to filter on city something like

Dim S =gridview.columns("city").GetFilterDescription

's contains " city = 'berlin' "

otherwise I have to create the text from scratch.....

W
Top achievements
Rank 1
 answered on 02 Sep 2016
5 answers
299 views

I've just downloaded the UI for WPF Q2 2016. I'm trying to use the Search as you type feature, but it's throwing exceptions.

My XAML looks as follows:

<telerik:RadGridView ItemsSource="{Binding Table}" AutoGenerateColumns="True"></telerik:RadGridView>

And my ViewModel:

public class TestViewModel : INotifyPropertyChanged
{
    private DataTable _table;
    public event PropertyChangedEventHandler PropertyChanged;
 
    public TestViewModel()
    {
        var table = new DataTable();
 
        table.Columns.Add("StringValue", typeof(string));
 
        for (int i = 0; i < 100; i++)
        {
            table.Rows.Add($"String Value {i}");
        }
 
        Table = table;
    }
 
    public DataTable Table
    {
        get { return _table; }
        set
        {
            _table = value;
            OnPropertyChanged(nameof(Table));
            OnPropertyChanged(nameof(View));
        }
    }
 
    public DataView View { get { return Table.DefaultView; } }
     
    protected virtual void OnPropertyChanged(string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}

 

When thrying to search as you type I get an ArgumentException with message: "Column '[StringValue]' does not belong to table".

I've tried binding to the Table as well as the DefaultView of the table, but the results are the same.

public class TestViewModel : INotifyPropertyChanged
{
    private DataTable _table;
    public event PropertyChangedEventHandler PropertyChanged;
    public TestViewModel()
    {
        var table = new DataTable();
        table.Columns.Add("StringValue"typeof(string));
        for (int i = 0; i < 100; i++)
        {
            table.Rows.Add($"String Value {i}");
        }
        Table = table;
    }
    public DataTable Table
    {
        get return _table; }
        set
        {
            _table = value;
            OnPropertyChanged(nameof(Table));
            OnPropertyChanged(nameof(View));
        }
    }
    public DataView View { get return Table.DefaultView; } }
    
    protected virtual void OnPropertyChanged(string propertyName = null)
    {
        PropertyChanged?.Invoke(thisnew PropertyChangedEventArgs(propertyName));
    }
}
public class TestViewModel : INotifyPropertyChanged
{
    private DataTable _table;
    public event PropertyChangedEventHandler PropertyChanged;
    public TestViewModel()
    {
        var table = new DataTable();
        table.Columns.Add("StringValue"typeof(string));
        for (int i = 0; i < 100; i++)
        {
            table.Rows.Add($"String Value {i}");
        }
        Table = table;
    }
    public DataTable Table
    {
        get return _table; }
        set
        {
            _table = value;
            OnPropertyChanged(nameof(Table));
            OnPropertyChanged(nameof(View));
        }
    }
    public DataView View { get return Table.DefaultView; } }
    
    protected virtual void OnPropertyChanged(string propertyName = null)
    {
        PropertyChanged?.Invoke(thisnew PropertyChangedEventArgs(propertyName));
    }
}
public class TestViewModel : INotifyPropertyChanged
{
    private DataTable _table;
    public event PropertyChangedEventHandler PropertyChanged;
    public TestViewModel()
    {
        var table = new DataTable();
        table.Columns.Add("StringValue"typeof(string));
        for (int i = 0; i < 100; i++)
        {
            table.Rows.Add($"String Value {i}");
        }
        Table = table;
    }
    public DataTable Table
    {
        get return _table; }
        set
        {
            _table = value;
            OnPropertyChanged(nameof(Table));
            OnPropertyChanged(nameof(View));
        }
    }
    public DataView View { get return Table.DefaultView; } }
    
    protected virtual void OnPropertyChanged(string propertyName = null)
    {
        PropertyChanged?.Invoke(thisnew PropertyChangedEventArgs(propertyName));
    }
}
public class TestViewModel : INotifyPropertyChanged
{
    private DataTable _table;
    public event PropertyChangedEventHandler PropertyChanged;
    public TestViewModel()
    {
        var table = new DataTable();
        table.Columns.Add("StringValue"typeof(string));
        for (int i = 0; i < 100; i++)
        {
            table.Rows.Add($"String Value {i}");
        }
        Table = table;
    }
    public DataTable Table
    {
        get return _table; }
        set
        {
            _table = value;
            OnPropertyChanged(nameof(Table));
            OnPropertyChanged(nameof(View));
        }
    }
    public DataView View { get return Table.DefaultView; } }
    
    protected virtual void OnPropertyChanged(string propertyName = null)
    {
        PropertyChanged?.Invoke(thisnew PropertyChangedEventArgs(propertyName));
    }
}
Yoan
Telerik team
 answered on 02 Sep 2016
6 answers
339 views

I have a RadCartesianChart with one ScatterPointSeries when the number of points is 20000 the time to plot is 40 seconds.

The class where stored values:

public class ChartDataFlatness
{
    public double XValue { get; set; }
    public double YValue { get; set; }
    public Brush Brush { get; set; }
}

The class used to pass value to RadCartesianChart

class ViewModelFlatness : ViewModelBase
{
    private List<ChartDataFlatness> data;
    public ViewModelFlatness() { }
    public List<ChartDataFlatness> Data {
        get { return this.data; }
        set {
            if (this.data != value) {
                this.data = value;
                this.OnPropertyChanged("Data");
            }
        }
    }
}

The user control used for show the data:

<UserControl x:Class="TiQ.Qua.Tna.Quality.Station.UserControls.UserControlChartFlatnessQualityStation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:classes="clr-namespace:TiQ.Qua.Tna.Quality.Station.Classes"
             mc:Ignorable="d" RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
    <Grid>
        <telerik:RadCartesianChart x:Name="RadChartFlatness" LayoutUpdated="RadChartFlatness_LayoutUpdated" >
            <telerik:ScatterPointSeries XValueBinding="XValue" YValueBinding="YValue"  >
                <telerik:ScatterPointSeries.PointTemplate>
                    <DataTemplate>
                        <Rectangle Width="10" Height="10" Fill="{Binding DataItem.Brush}"/>
                    </DataTemplate>
                </telerik:ScatterPointSeries.PointTemplate>
            </telerik:ScatterPointSeries>
            <telerik:RadCartesianChart.HorizontalAxis><telerik:LinearAxis VerticalLocation="Top" /></telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis><telerik:LinearAxis IsInverse="True" /></telerik:RadCartesianChart.VerticalAxis>
        </telerik:RadCartesianChart>
    </Grid>
</UserControl>

The code used to set data for RadGraph:

ViewModelFlatness _viewModel = new ViewModelFlatness { };
// Set Data of _viewModel
RadChartFlatness.Series[0].ItemsSource = _viewModel.Data;

It is possibile to reduce the time to plot data to 2/5 seconds.

Greetings,

Paolo​

Sam
Top achievements
Rank 1
 answered on 02 Sep 2016
6 answers
434 views

The issues we can reproduce with the latest version 2016.2.822.40

 

Issues #1 and #2.
How to reproduce on the test project:
Run the application.
Click the «Create new QCV with group descriptor» button.

See pic. 1

We see two issues:
1. Groups inside the table are doubled. Group descriptors collection contains two group descriptors (of the same type: GroupDescriptor), but only one is shown in «Grouped by» section.
2. Grid itself does not notify when its GroupDescriptors collection has been changed, though QueryableCollectionView bound to this Grid notifies of its GroupDescriptors collection successfully.

Issue #3
How to reproduce on the test project:
Start the application.
Delete the «Profession» group descriptor (click on X in «Groupped by»).
Group by the «Profession» group manually (drag-and-drop column header onto «Grouped by»).
Click the «Create new QCV with group descriptor» button.

See pic. 2.

We see now, that group descriptors were doubled. In the GroupDescriptors collection of Grid there are two descriptors of two different types: ColumnGroupDescriptor and GroupDescriptor. And it seems impossible to programmatically add a descriptor of type «ColumnGroupDescriptor» in the viewmodel, because it should know about the UI (it needs column data), and hence is against the principles of MVVM.

Furthermore, if you now click the «Create new QCV with group descriptor» button again, you will see that groups are tripled:

See pic. 3




Dilyan Traykov
Telerik team
 answered on 02 Sep 2016
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?