Telerik Forums
UI for WPF Forum
1 answer
484 views
Hello. I write WPF MVVM Prism 6 multimodule application. In some View (let us call it PeppyView) I have RadTreeView which bound to ObservableCollection located in PeppyViewModel. This radTreeView is populated with data from this ObservableCollection. In turn, the ObservableCollection is populated with data from binary *.DAT file when user is clicking on the 'Deserialize' RadButton. After populating with the data my RadTreeView is shown as collapsed RadTreeView. But I need that my RadTreeView is shown as expanded after its populating with data. Because ViewModel has to have no knowlage about the View in MVVM I can't call RadTreeView.ExpandAll method from ViewModel code. So how can I expand RadTreeView in my case? Is there a way to map UI control's method to ViewModule and call it there?
Martin Ivanov
Telerik team
 answered on 05 Sep 2016
1 answer
464 views

Hi,

I was wondering how can I create a graphing paper background like the image attached.

http://previews.123rf.com/images/atthameeni/atthameeni1304/atthameeni130400133/18981872-graph-paper-illustrator-background-eps10-Stock-Vector.jpg

The graph will be properly aligned to time in X-Axis. Any way to do it?

 

Thanks,

Gaurav

 

Martin Ivanov
Telerik team
 answered on 05 Sep 2016
5 answers
389 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
178 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
181 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
284 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
108 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
208 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
102 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
292 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?