Telerik Forums
UI for WPF Forum
5 answers
787 views
Hi,
  We are using telerik treeview along with MVVM pattern in a WPF application. The view model exposes an observable collection to which nodes in the tree bound to. Also, viewmodel exposes the commands required to add delete and edit nodes in the tree.

I think, When i add/remove an item in the observable collection it should get reflected in the tree but my concern is, will it preserve the state of expanded tree node after its child nodes are modified?

Also i need to add (drop) a node in the treeview by dragging it from another tree or any other control.

I have few queries:
1. Can you please provide us a sample for add/edit/delete node and drag/drop? It will be great if sample uses MVVM pattern.
2. How theses operations in RadTreeVIew are diffrent/easy as comapred to when i use WPF standard treeview
3.  Can you please shed some light on UI virtualization support in telerik wpf treeview?

Thanks
Sonal
Petar Mladenov
Telerik team
 answered on 02 Feb 2011
4 answers
148 views
Hello,

I am trying to apply the Windows 7 theme to the RadDataFilter control.  If I do so in XAML it works fine.  But, if I try to style the control programmatically when the control is loaded (an approach that works for the RadGridView), it does not seem to work.  Does anyone know how I can go about styling the control programmatically?

The code I am using is as follows:

// Specify the theme to use for this control.
Theme theme = ThemeManager.FromName("Windows7");
if (theme != null)
{
    StyleManager.SetTheme(this, theme);
}

As always, any help, pointers or even thoughts would be appreciated!

Thanks,
Mark.



Mark
Top achievements
Rank 1
 answered on 02 Feb 2011
2 answers
164 views
I have a RadChart that has a dynamic set of lineSeries that i add to it after recieving the data from an end device.  When i try to clear the Chart for new data, the legend Items do not get cleared. 
private void AddTrendPoints(TrendFiles trendfile)
        {
            if (this.trendGraph.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.trendGraph.Dispatcher.Invoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate
                {
                     
                    #region Setup Series
                    this.trendGraph.DefaultView.ChartArea.DataSeries.Clear();
                    this.trendGraph.DefaultView.ChartArea.Legend.Items.Clear();
                    this.trendGraph.SamplingSettings.SamplingThreshold = trendfile.Records;
                    DataSeries series = new DataSeries();
                    LineSeriesDefinition lineDefinition = new LineSeriesDefinition();
                    ChartLegendItem legendItem = new ChartLegendItem();
                    int count = 0;
  
                    foreach(TrendVariable trendVar in trendfile.Variables)
                    {
                        series = new DataSeries();
                        lineDefinition = new LineSeriesDefinition();
                        legendItem = new ChartLegendItem();
                        lineDefinition.ShowItemLabels = false;
                        lineDefinition.ShowPointMarks = false;
                        lineDefinition.SeriesName = trendVar.Name;
                        lineDefinition.LegendDisplayMode = LegendDisplayMode.SeriesLabel;
                        series.LegendLabel = trendVar.Name;
                        series.Definition = lineDefinition;
                        series.Definition.Appearance.Stroke = colors[count];
                        series.Definition.Appearance.Fill = colors[count];
                        legendItem.Label = trendVar.Name;
                        legendItem.Background = colors[count];
                        legendItem.Foreground = Brushes.White;
                        trendGraph.DefaultView.ChartLegend.Items.Add(legendItem);
                          
                        foreach (DataPoint point in trendVar.points)
                        {
                            series.Add(point);
                        }
  
                        trendGraph.DefaultView.ChartArea.DataSeries.Add(series);
                         
                        count++;
                    }
  
                    #endregion
  
  
                    return null;
                }), null);
  
            }
            else
            {
                #region Setup Series
                this.trendGraph.DefaultView.ChartArea.DataSeries.Clear();
                this.trendGraph.DefaultView.ChartArea.Legend.Items.Clear();
  
                DataSeries series = new DataSeries();
                LineSeriesDefinition lineDefinition = new LineSeriesDefinition();
                ChartLegendItem legendItem = new ChartLegendItem();
                int count = 0;
  
                foreach (TrendVariable trendVar in trendfile.Variables)
                {
                    series = new DataSeries();
                    lineDefinition = new LineSeriesDefinition();
                    legendItem = new ChartLegendItem();
                    lineDefinition.ShowItemLabels = false;
                    lineDefinition.ShowPointMarks = false;
                    lineDefinition.SeriesName = trendVar.Name;
                    lineDefinition.LegendDisplayMode = LegendDisplayMode.SeriesLabel;
                    series.LegendLabel = trendVar.Name;
                    series.Definition = lineDefinition;
                    series.Definition.Appearance.Stroke = colors[count];
                    series.Definition.Appearance.Fill = colors[count];
                    legendItem.Label = trendVar.Name;
                    legendItem.Background = colors[count];
                    legendItem.Foreground = Brushes.White;
                    trendGraph.DefaultView.ChartLegend.Items.Add(legendItem);
                    foreach (DataPoint point in trendVar.points)
                    {
                        series.Add(point);
                    }
                    trendGraph.DefaultView.ChartArea.DataSeries.Add(series);
                    count++;
                }
  
                #endregion
  
            }
  
        }


After the initial load, the legend items just append to the legend.  So i get repeat Series legend items.  Its not being cleared on the Legend.Items.Clear() method.

Brian
Top achievements
Rank 1
 answered on 02 Feb 2011
1 answer
56 views
   Hi Telerik,

I have a couple of question about how to change the appeance of the selection style.

1. I have disabled editing and do not wish the selection to display a rectangular border around the clicked cell, i just want the row to be selected as per default when the application starts and no cell has been clicked.

2. Can I remove the selection style completely? I'm using the treelistview to display a set of data where I have disabled selection, but when I populate the data, as per default the first item is selected and given the selection style which ruins the layout abit. I still wish to keep the rowheader but without the arrow icon used for selection.

Thanks in advance,

/Kasper Schou
Vanya Pavlova
Telerik team
 answered on 02 Feb 2011
4 answers
127 views
Hello, 

I have the need to be able to persist and restore the state of a RadDataFilter.  I was hoping to be able to save-off and restore the FilterDescriptors collection, but unfortunately it is read-only.  So, what would be the best approach to making this happen?  Is persistence supported at all?

Thanks,
Mark


Mark
Top achievements
Rank 1
 answered on 02 Feb 2011
2 answers
132 views
Hi,

I have a problem using the
  • GridViewCheckBoxColumn
  • GridViewComboBoxColumn
When I edit data in a "GridViewDataColumn" and execute my custom "UpdateItemCommand" I have no problems and my SelectedItem displays the changes which were entered in the "GridViewDataColumn".
However the problem occurs when I edit a "GridViewCheckBoxColumn" or "GridViewComboBoxColumn". The SelectedItem does not display the changes made by these Columns.

Thank you for your help!
Martin

<my:RadGridView x:Name="RadGridView" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemsSource="{Binding PLC_Items}>
        <my:RadGridView.Columns>
            <my:GridViewDataColumn Header="ID" DataMemberBinding="{Binding ID}" IsReadOnly="True"/>
            <my:GridViewDataColumn Header="ItemName" DataMemberBinding="{Binding Name}" Width="*"/>
            <my:GridViewComboBoxColumn Header="Function" ItemsSource="{Binding AllFunctions}" DataMemberBinding="{Binding Function}"/>
            <my:GridViewCheckBoxColumn Header="Auto Update" DataMemberBinding="{Binding AutoUpdate, Mode=TwoWay}"/>
            <my:GridViewColumn Width="Auto">
                <my:GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <telerik:RadButton Command="{Binding DataContext.WriteItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.UpdateItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.ReadItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.DeleteItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                        </StackPanel>
                    </DataTemplate>
                </my:GridViewColumn.CellTemplate>
            </my:GridViewColumn>
        </my:RadGridView.Columns>
    </my:RadGridView>


Martin
Top achievements
Rank 1
 answered on 02 Feb 2011
1 answer
173 views

Hello

When the Grid View Data Column bound to date time,

If there is string format that show only the time it looks like bug.

We need that the filtering controls display the same date once.

Looks at the attach pictures.

How to resolve this problem?

Best regards

Ehud.

Ivan Ivanov
Telerik team
 answered on 02 Feb 2011
1 answer
177 views
Hello friends,

I am trying to implement the MouseLeftButtonDown-Event for some PanelBarItems. But the Event isn't fired. Could you please help me to find out why it isn't?

<telerik:RadPanelBar ExpandMode="Multiple" VerticalAlignment="Stretch" Name="pbarMain">
    <!-- Kapazitäten -->
    <telerik:RadPanelBarItem VerticalAlignment="Stretch" IsExpanded="True">
        <telerik:RadPanelBarItem.Header>
            <StackPanel Orientation="Horizontal" Margin="5 4 5 5">
                <Image Source="Images/kapazität.ico"
                       Style="{StaticResource style_image_20x20}"/>
                <Label Content="Kapazitäten" FontWeight="Bold"/>
            </StackPanel>
        </telerik:RadPanelBarItem.Header>
     
        <telerik:RadPanelBarItem MouseLeftButtonDown="RadPanelBarItem_MouseDown"
                                 Tag="KapaViewPage.xaml">
            <telerik:RadPanelBarItem.Header>
                <StackPanel Orientation="Horizontal" Margin="10 4 5 5">
                    <Image Source="Images/Document_search.ico"
                           Style="{StaticResource style_image_16x16}"/>
                    <Label Content="Anzeigen/Bearbeiten"/>
                </StackPanel>
            </telerik:RadPanelBarItem.Header>
        </telerik:RadPanelBarItem>


private void RadPanelBarItem_MouseDown(object sender, MouseButtonEventArgs e)
{
    if (sender != null)
    {
        RadPanelBarItem item = sender as RadPanelBarItem;
        if (item.Tag != null)
        {
            string ziel = item.Tag.ToString();
 
            if (ziel.Length > 0) mvm.Navigate(ziel);
        }
    }
}



Petar Mladenov
Telerik team
 answered on 02 Feb 2011
2 answers
159 views

Hi,
Previously I was using this code in WPF .net 4.0 framework and was working correctly.

Code at RowLoaded Event:
 

TreeListViewRow row = e.Row as TreeListViewRow; 
   
Binding binding = new Binding("IsExpanded") { Source = row.Item }; 
  
binding.Mode = BindingMode.TwoWay; 
  
row.SetBinding(TreeListViewRow.IsExpandedProperty, binding);

 

 

 

which indirectly calls the

RowIsExpandedChanging event somehow.
But now when I migrated to .net 3.5 framework, due to some limitations, the same code was not working.
Now it is not calling the RowIsExpandedChanging event.
Please suggest me how to overcome from this problem, is there any other way to do the same in .net 3.5.

Thanks in Advance.

 

 

 

Manishkumar
Top achievements
Rank 1
 answered on 02 Feb 2011
3 answers
122 views
Hi, I have a problem when populating stacked bar charts. My code is following:
XMAL:
<telerik:RadChart x:Name="chart" PaletteBrushesRepeat="False" telerik:Theming.Theme="Summer">
 </telerik:RadChart>

C#:
chart.SeriesMappings.Clear();
            chart.DefaultView.ChartArea.DataSeries.Clear();
            chart.DefaultView.ChartLegend.UseAutoGeneratedItems = true;
            chart.DefaultSeriesDefinition.LegendDisplayMode = LegendDisplayMode.SeriesLabel;
             
            for (int i = 0; i < model.Captions.Count; i++ )
            {
                SeriesMapping sm = new SeriesMapping();
                StackedBarSeriesDefinition dd = new StackedBarSeriesDefinition();
                 
                dd.StackGroupName = "Stack1";
                sm.SeriesDefinition = dd;
                sm.LegendLabel = "Stacked Bar " + i;
                sm.CollectionIndex = i;
                 
                ItemMapping im1 = new ItemMapping();
                im1.DataPointMember = DataPointMember.YValue;
                sm.ItemMappings.Add(im1);
                chart.SeriesMappings.Add(sm);
            }
 
            List<double[]> itemsSource = new List<double[]>();
            for (int i = 0; i < model.Children.Count; i++)
            {
                double[] d =  model.Children[i].Values.Select(s => s.AdjustedValue).ToArray();
                itemsSource.Add(d);
            }

I'm not sure where I'm going wrong here but I'd thought "sm.LegendLabel = "Stacked Bar " + i; " would provide my with legend items.

Best regards
Kristján.
Kristjan Einarsson
Top achievements
Rank 1
 answered on 02 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?