Telerik Forums
UI for WPF Forum
3 answers
1.8K+ views
Hi,

I'm having trouble trying to remove a treeview item programmatically.

I add tree items roughly like so:
RadTreeViewItem item = new RadTreeViewItem();
item.Header = "Header 1";
item.Tag = myProperty;
 
treeProducts.Add(item);


I then try to use the following method to remove the desired TreeItem:
//Get Selected Tree Item
RadTreeViewItem treeViewItem = (RadTreeViewItem)treeProducts.SelectedItem;
//Remove TreeView Item
this.treeProducts.Items.Remove(treeViewItem);


For some reason it will only remove "TOP LEVEL" tree items and not items that are child nodes.

Do you know how I can programmatically remove a TreeItem that isn't a top level node?

I can see that it has something to do with the RadTreeView Items Collection, where it only lists all top level nodes.

Thank you for time,

Rob
Karthi
Top achievements
Rank 1
 answered on 07 Mar 2015
9 answers
276 views
Is there a "master" Property I can set to disable all coloring from Telerik ?

I want the basic Windows' current Theme to be displayed...

Thanks !
Louis
Top achievements
Rank 1
 answered on 06 Mar 2015
6 answers
245 views
Hello,

Is there a way to detect if a cell is set readonly by the IsReadOnlyBinding property of the parent column?

I need it for two reasons:

1. I want do display text inside _all_ readonly cells in Italics. The preferred way to do this would be some Trigger in the ControlTemplate of the GridViewCell (I have created my own cell template anyway).

2. I have to check it before entering edit mode. I manually set the IsInEditMode property of the cell on MouseUp, not on MouseDown (as default), as MouseDown should only select the cell.

Alex
Ivan Ivanov
Telerik team
 answered on 06 Mar 2015
3 answers
63 views
Hi,

I'm using a drag drop behavior and in the DragDropCompleted operation I would like to highlight (select) the appointments that I just dragged, is this possible?

Thank's
Alain
Nasko
Telerik team
 answered on 06 Mar 2015
4 answers
179 views
Hi,

I am trying to use RowStyleSelector with a RadGridView having an ItemsSource of type ObservableCollection<T>. The RowStyleSelector looks at the value of a property of T to set the background color of the corresponding row.

My problem is that the items may be altered outside of the grid. The new values are immediately picked up by the cells of the grid (because of the ObservableCollection and because T implements INotifyPropertyChanged), but the row style is not updated accordingly. However, if I sort the grid by clicking on one of the columns, the row styles are updated.

How can I ensure that the style is updated as soon as the values of the cells are updated?

In case it matters, this is how the RadGridView is declared (stripped down a bit):
<telerik:RadGridView Name="DocumentGrid" SelectionMode="Extended" ItemsSource="{Binding Path=Documents}" AutoGenerateColumns="False" IsReadOnly="True" RowStyleSelector="{StaticResource DocumentStyleSelector}">

This is the RowStyleSelector (stripped down a bit):
internal class DocumentStyleSelector : StyleSelector
{
    public Style DocumentModifiedStyle { get; set; }
 
    public override Style SelectStyle(object item, DependencyObject container)
    {
        var document = item as Document;
        if (document != null && document.EntityState == EntityState.Modified)
        {
            return DocumentModifiedStyle;
        }
        return null;
    }
}

And this is the Style (stripped down a b
<layout:DocumentStyleSelector x:Key="DocumentStyleSelector">
    <layout:DocumentStyleSelector.DocumentModifiedStyle>
        <Style TargetType="telerik:GridViewRow">
            <Setter Property="Background" Value="DarkGray" />
        </Style>
    </layout:DocumentStyleSelector.DocumentModifiedStyle>
</layout:DocumentStyleSelector>


Best regards
Linus
Dimitrina
Telerik team
 answered on 06 Mar 2015
3 answers
326 views
Hi I see there are 3 sizes for tiles at the moment. Single, Double and quadruple.

I was wondering if there are anymore sizes. I would like a Double and a Quadruple to be Stack ontop of eachother vertically. 
Maya
Telerik team
 answered on 06 Mar 2015
2 answers
87 views
Hi Team,

The RadGridView performs very poorly when you sort by a column with non unique values and select many rows. The UI thread gets stuck and it takes a while for it to come back, which causes issues with updates or other user operations following it. Our test was done on 50,000 rows.

To reproduce:
1. Bind RadGridView ItemsSource to a collection with 50,000 items. Set selection mode to Extended.  Make one values of one property unique and the other constant.
2. Run the sample and sort by the column with constant value.
3. Select all rows in the grid (CTRL+A)
4. Click on any row on the grid to verify that Dispatcher thread is locked. 
Note that if grid is sorted by unique value column same operation is fairly fast.

See below for the sample view, code behind and VM to reproduce this issue.
<Window x:Class="VariousDataSources.MainWindow"
        Title="MainWindow" >
    <Window.Resources>
    </Window.Resources>
        <telerik:RadGridView x:Name="RadGridView1" GroupRenderMode="Flat" AutoGenerateColumns="True"
                             RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False"
                             ItemsSource="{Binding DataSource}" SelectionMode="Extended">
        </telerik:RadGridView>
</Window>
 
 
   public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MyModel();
        }
    }

public class MyRow
  {
      public int SlowColumn { get; set; }
      public int FastColumn { get; set; }
  }
 
  public class MyModel : ViewModelBase
  {
      public MyModel()
      {
 
          DataSource = new ObservableCollection<MyRow>();
          for (var i = 0; i < 50000; i++)
          {
              var row = new MyRow();
              row.SlowColumn = 1;
              row.FastColumn = i;
              DataSource.Add(row);
          }
      }
 
      public ObservableCollection<MyRow> DataSource { get; set; }
  }
Maya
Telerik team
 answered on 05 Mar 2015
1 answer
162 views
Good Morning.

I need to put a RadAutoCompleteBox inside a GridViewDataColumn, I follow this RadAutoCompleteBox inside GridView example.

Works only when I editing an existent column, but I facing problems when I try to Insert a new row or when I Cancel any modifications.

When I need to insert a new record I call the method BeginInsert of GridView.

this.radGridView.BeginInsert();

It add a new empty row at the end, but then the autocomplete doesn't work anymore.

When I want edit an existing row, and suddenly I decide to cancel the edition; I press Esc key and the value of the column doesn't return to his original value.

I Attach an example of the solution, it has a button with click event, and in the event I call BeginInsert method.
I upload it to dropbox.

Many thanks.
Dimitrina
Telerik team
 answered on 05 Mar 2015
5 answers
109 views
Hi,

I have a custome aggregate function defined as follows. I would like to access the column name on which this particular function is being called from so that the function can act on that particular column. How can that be done? Currently I have hard-coded the column name('Score') which I do not want to do.

class Summation : AggregateFunction<BindableDynamicDictionary, int>
    {
        public Summation()
        {
            this.AggregationExpression = items => FindSum(items);
             
        }
 
        private int FindSum(IEnumerable<BindableDynamicDictionary> source)
        {
 
            var itemCount = source.Count();
            int sum = 0;
            if (itemCount >= 1)
            {
                var values = source.Select(i => i["Score"]);
                 
                foreach (int str in values)
                {
                    sum = sum + str;
                }
            }
 
            return sum;
        }
    }



Thanks
Dimitrina
Telerik team
 answered on 05 Mar 2015
6 answers
311 views
Hi,

I was wondering if there was a way to achieve column grouping similar to http://www.telerik.com/help/winforms/gridview-viewdefinitions-column-groups-view.html in WPF?

I have tried adding to the ChildGroups of the column groups but this doesn't seem to work the same way as the example in the above link.

The problem that I am seeing is that for column groups that do not have nested groups there appears to be an extra row added above each of these (to fill the space for those groups that do have children) which doesn't pick up my style and pushes the content of these groups down so not all of it is visible. What I would like to happen is that for the column groups that contain no nested groups is that the content of these cells fills the space without the extra row above it like the "Customer Contact" group in the winforms example in the link.

Thanks,

Steven
Dimitrina
Telerik team
 answered on 05 Mar 2015
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?