Telerik Forums
UI for WPF Forum
4 answers
110 views
Hey,

Was labbing some this morning and i come over this.

   <telerik:GridViewDataColumn Header="LogistikID" DataMemberBinding="{Binding nOrderID}" />
   <telerik:GridViewDataColumn Header="Namn" DataMemberBinding="{Binding strDisplayName}"/>
   <telerik:GridViewDataColumn Header="CareOf" DataMemberBinding="{Binding strCareOf}"/>
   <telerik:GridViewDataColumn Header="Gata" DataMemberBinding="{Binding strAddress}"/>
   <telerik:GridViewDataColumn Header="" />


If i leave one column not binded the Gridview lags like hell.

Im pretty sure i have to bind them all because i use GridViewDataColumn, but is it realy gonna lag so bad?

If i leave it empty, Shouldn't it just be ignored?

If i bind the last GridViewDataColumn it's lag free while scrolling/filtering.

Bug or Feature? 

/Joachim
Joachim Karlsson
Top achievements
Rank 1
 answered on 02 Mar 2012
2 answers
131 views
http://www.telerik.com/community/forums/wpf/gridview/filtered-records-list.aspx

I found an old forum thread describing the problem, but its from 2009.

Within a DataTemplate I have GridView.
Within the same datatemplate I have a button where I want to do a bulk operation on the filtered set of items.
The datacontext of the DataTemplate is an INotifyPropertyChanged derived object, which provides the GridView ItemsSource.

How do I, when handling the button click, obtain the list of filtered items back from the RadGridView?

The DataTemplate is hosted within the body of a data driven RadTabControl, if it matters.
Tormod
Top achievements
Rank 1
 answered on 02 Mar 2012
2 answers
264 views
Dear Telerik team,

i'm using a RadScheduleView Control, with Appointment Templates as used in your examples/demos (works great).
Now i want to extend the show duration of a tooltip from an appointment.

Per default it's set to 5-6 seconds, but i need it at least for 20 seconds.

I read in your forum that this can be done by setting the ToolStipService ShowDuration

eg.:
ToolTipService.ShowDuration="20000"

I tried to set his in the control template of the "root" Grid, but it doesn't work.
Can you tell me how to set this property to take this effect, or is there another configuration needed ?

eg.: Horizontal Style for an Appointment

<Style x:Key="Level200HorizontalStyle" TargetType="telerik:AppointmentItem">   
           <Setter Property="Background" Value="{StaticResource AppointmentBackground}" />
           <Setter Property="BorderBrush" Value="{StaticResource AppointmentBorder}" />
           <Setter Property="Padding" Value="5" />
           <Setter Property="Foreground" Value="{StaticResource AppointmentForeground}" />
           <Setter Property="FontSize" Value="10" />
           <!-- Setter Property="FontFamily" Value="Arial"/ -->
           <Setter Property="Template">
               <Setter.Value>
                   <ControlTemplate TargetType="{x:Type telerik:AppointmentItem}">
                       <Grid x:Name="Root" ToolTipService.ShowDuration="20000"
>
                           <Grid.InputBindings>
                               <MouseBinding MouseAction="LeftDoubleClick" Command="scheduleView:RadScheduleViewCommands.EditAppointment"/>
                           </Grid.InputBindings>
                           <Border BorderBrush="{TemplateBinding BorderBrush}"
                                   BorderThickness="{TemplateBinding BorderThickness}"
                                   Background="{TemplateBinding Background}" CornerRadius="2" />
                           <Border x:Name="CommonStatesVisual" BorderThickness="{TemplateBinding BorderThickness}"
                                   Background="{StaticResource AppointmentMouseOver}"
                                   BorderBrush="{TemplateBinding BorderThickness}" CornerRadius="2"
                                   Visibility="Collapsed" />
                           <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   Margin="{TemplateBinding Padding}">
                               <Grid.ColumnDefinitions>
                                   <ColumnDefinition Width="20" />
                                   <ColumnDefinition Width="Auto" />
                               </Grid.ColumnDefinitions>
                               <ContentPresenter />
                           </Grid>
                           <Grid x:Name="MouseOverOverlay" Opacity="0" Visibility="Collapsed">
                               <Border x:Name="PART_StartResizeGrip" telerik:RadDragAndDropManager.AllowDrag="True"
                                       Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Left"
                                       VerticalAlignment="Stretch">
                                   <StackPanel x:Name="StartResizeGrip"
                                           HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center" Background="#FF878787">
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                   </StackPanel>
                               </Border>
                               <Border x:Name="PART_EndResizeGrip" telerik:RadDragAndDropManager.AllowDrag="True"
                                       Background="Transparent" Cursor="SizeWE" HorizontalAlignment="Right"
                                       VerticalAlignment="Stretch">
                                   <StackPanel x:Name="EndResizeGrip"
                                           HorizontalAlignment="Center" Margin="1" VerticalAlignment="Center" Background="#FF878787">
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                       <Rectangle Fill="White" Height="2" Margin="1" Width="2" />
                                   </StackPanel>
                               </Border>
                           </Grid>
                       </Grid>
                       <ControlTemplate.Triggers>
                           <Trigger Property="IsDragged" Value="True">
                               <Setter Property="Opacity" TargetName="Root" Value="0.3" />
                           </Trigger>
                           <Trigger Property="IsMouseOver" Value="True">
                               <Trigger.EnterActions>
                                   <BeginStoryboard>
                                       <Storyboard>
                                           <ObjectAnimationUsingKeyFrames Duration="0:0:0.4"
                                                   Storyboard.TargetProperty="Visibility"
                                                   Storyboard.TargetName="MouseOverOverlay">
                                               <DiscreteObjectKeyFrame KeyTime="0">
                                                   <DiscreteObjectKeyFrame.Value>
                                                       <Visibility>Visible</Visibility>
                                                   </DiscreteObjectKeyFrame.Value>
                                               </DiscreteObjectKeyFrame>
                                           </ObjectAnimationUsingKeyFrames>
                                           <DoubleAnimation BeginTime="0:0:0.2" Duration="0:0:0.2" To="1"
                                                   Storyboard.TargetProperty="Opacity"
                                                   Storyboard.TargetName="MouseOverOverlay" />
                                       </Storyboard>
                                   </BeginStoryboard>
                               </Trigger.EnterActions>
                               <Trigger.ExitActions>
                                   <BeginStoryboard>
                                       <Storyboard>
                                           <ObjectAnimationUsingKeyFrames Duration="0:0:0.2"
                                                   Storyboard.TargetProperty="Visibility"
                                                   Storyboard.TargetName="MouseOverOverlay">
                                               <DiscreteObjectKeyFrame KeyTime="0:0:0.2">
                                                   <DiscreteObjectKeyFrame.Value>
                                                       <Visibility>Collapsed</Visibility>
                                                   </DiscreteObjectKeyFrame.Value>
                                               </DiscreteObjectKeyFrame>
                                           </ObjectAnimationUsingKeyFrames>
                                           <DoubleAnimation BeginTime="0" Duration="0:0:0.2" To="0"
                                                   Storyboard.TargetProperty="Opacity"
                                                   Storyboard.TargetName="MouseOverOverlay" />
                                       </Storyboard>
                                   </BeginStoryboard>
                               </Trigger.ExitActions>
                               <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible" />
                               <Setter Property="Visibility" TargetName="MouseOverOverlay" Value="Visible" />
                           </Trigger>
                           <Trigger Property="IsSelected" Value="True">
                               <Setter Property="Visibility" TargetName="CommonStatesVisual" Value="Visible" />
                           </Trigger>
                       </ControlTemplate.Triggers>
                   </ControlTemplate>
               </Setter.Value>
           </Setter>
       </Style>

best regards
rudi
Rudolf
Top achievements
Rank 1
 answered on 01 Mar 2012
8 answers
503 views
Hi,

I have a RadGridView, depending of the grid type I need, I build dynamically each columns and each aggregate functions. Each time I build a grid, at least one decimal column exist. For othe aggregate functions than SUM, it work...
 
When I assign the ItemSource to the array of objects I receive from the back-end, I receive the following message: "Aucune méthode 'Sum' sur le type 'System.Linq.Enumerable' n'est compatible avec les arguments fournis."

xaml:

<

 

telerik:RadGridView x:Name="radGridViewList" Margin="5 0 5 5" Visibility="Visible" RowDetailsVisibilityMode="Collapsed" FrozenColumnCount="1"

 

 

RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" Grid.Row="3"

 

 

CanUserResizeColumns="True" ShowColumnFooters="True" ShowGroupFooters="True" SelectionMode="Extended" IsSynchronizedWithCurrentItem="True"> />

 


Code behind:

  static public void SetColumns(RadGridView pGrid, ColumnDescriptor[] pColumnNames)
  {
   if (pColumnNames != null)
   {               
                EnumerableAggregateFunctionBase aggFunc;

    for (int iColumnIndex = 0; iColumnIndex < pColumnNames.Length; iColumnIndex++)
    {
     ColumnDescriptor oneName = pColumnNames[iColumnIndex];
     GridViewDataColumn oneColumn = new Telerik.Windows.Controls.GridViewDataColumn();

     oneColumn.Header = oneName.ColumnName;
     
                    //Apply proper column display format.
     switch (oneName.Format.ToUpper())
     {
      case "$":
       oneColumn.DataFormatString = "C2";
       break;

      case "D":
       oneColumn.DataFormatString = "yyyy'-'MM'-'dd";                           
       break;

      case "H":
       oneColumn.DataFormatString = "HH':'mm";                           
       break;

      case "DH":
       oneColumn.DataFormatString = "yyyy'-'MM'-'dd' 'HH':'mm";
       break;
     }

     oneColumn.Width = new GridViewLength(1, GridViewLengthUnitType.Star);
     oneColumn.ShowFilterButton = true;
     oneColumn.IsSortable = true;
     oneColumn.IsFilterable = true;
     oneColumn.DataMemberBinding = new Binding(string.Format("ElementCells[{0:D}]", iColumnIndex));
     oneColumn.TextAlignment = (TextAlignment)oneName.TextAlignment;
     oneColumn.HeaderTextAlignment = (TextAlignment)oneName.TextAlignment;

                    //Create proper aggregate functions.
                    if (oneName.Agregation != AgregationFunction.None)
                    {
                        aggFunc = null;

                        switch (oneName.Agregation)
                        {
                            case AgregationFunction.Average:
                                aggFunc = new AverageFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Average") + ": "
                                };
                                break;
                            case AgregationFunction.Count:
                                aggFunc = new CountFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Count") + ": "
                                };
                                break;
                            case AgregationFunction.FirstValue:
                                aggFunc = new FirstFunction()
                                {
                                    Caption = LocGeneral.GetControlText("First") + ": "
                                };
                                break;
                            case AgregationFunction.LastValue:
                                aggFunc = new LastFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Last") + ": "
                                };
                                break;
                            case AgregationFunction.MaxValue:
                                aggFunc = new MaxFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Max") + ": "
                                };
                                break;
                            case AgregationFunction.MinValue:
                                aggFunc = new MinFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Min") + ": "
                                };
                                break;
                            case AgregationFunction.Sum:
                                aggFunc = new SumFunction()
                                {
                                    Caption = LocGeneral.GetControlText("Sum") + ": ",
                                    SourceFieldType = typeof(Decimal)
                                };
                                break;

                        }

                        //If aggregate function created, we add it to the column.
                        if (aggFunc != null)
                        {
                            oneColumn.AggregateFunctions.Add(aggFunc);
                        }
                    }

     pGrid.Columns.Add(oneColumn);
    }
   }
  }


using System;
using System.Diagnostics;
using System.Runtime.Serialization;

namespace com.christiegrp.Neuron.Client
{
 [DataContract]
 public class CompleteConfiguration : NeuronClientBase
 {
  #region Constructors.
  public CompleteConfiguration(bool pReadFromDatabase)
   : base(pReadFromDatabase)
  {
  }
  #endregion

  #region NeuronClientBase overrides.
  protected override string getListBoxDisplay()
  {
   return Name;
  }

  protected override string[] getColumnNames()
  {
   switch (GuiLanguage)
   {
    case Languages.LanguageEn:
     return new string[] { "Code", "Name", "Contents" };

    case Languages.LanguageFr:
     return new string[] { "Code", "Nom", "Contenu" };
   }

   return null;
  }

  protected override object[] getItems()
  {
   return new object[] { Code, Name, Contents };
  }

  protected override void copyFrom(NeuronClientBase pSource)
  {
   base.copyFrom(pSource);

   CompleteConfiguration theSource = pSource as CompleteConfiguration;

   if (theSource == null)
   {
    throw new ArgumentException(WrongArgumentType, "pSource");
   }

   Code = theSource.Code;
   Name = theSource.Name;
   Contents = theSource.Contents;
   IsVisible = theSource.IsVisible;
  }
  #endregion

  #region Properties from main table.
  [DataMember]
  public string Code
  {
   [DebuggerStepThrough]
   get { return mCode; }
   [DebuggerStepThrough]
   set
   {
    if (mCode != value)
    {
     mCode = value;
     NotifyOfPropertyChange("Code");
    }
   }
  }

  [DataMember]
  public string Name
  {
   [DebuggerStepThrough]
   get { return mName; }
   [DebuggerStepThrough]
   set
   {
    if (mName != value)
    {
     mName = value;
     NotifyOfPropertyChange("Name");
    }
   }
  }

  [DataMember]
  public string Contents
  {
   [DebuggerStepThrough]
   get { return mContents; }
   [DebuggerStepThrough]
   set
   {
    if (mContents != value)
    {
     mContents = value;
     NotifyOfPropertyChange("Contents");
    }
   }
  }

  [DataMember]
  public bool IsVisible
  {
   [DebuggerStepThrough]
   get { return mIsVisible; }
   [DebuggerStepThrough]
   set
   {
    if (mIsVisible != value)
    {
     mIsVisible = value;
     NotifyOfPropertyChange("IsVisible");
    }
   }
  }
  #endregion

  #region Private fields.
  private string mCode;
  private string mName;
  private string mContents;
  private bool mIsVisible;
  #endregion
 }

 [DataContract]
 public class ColumnDescriptor
 {
  [DataMember]
  public string ColumnName { get; set; }

  [DataMember]
  public ColumnAlignment TextAlignment { get; set; }

  [DataMember]
  public AgregationFunction Agregation { get; set; }

  [DataMember]
  public int GroupingPosition { get; set; }

  [DataMember]
  public string Format { get; set; }
 }

 [DataContract]
 public class ListElements
 {
  public ListElements()
  {
   ElementGuid = Guid.Empty;
   ElementCells = null;
   IsSelected = false;
  }

  [DataMember]
  public Guid ElementGuid { get; set; }
  [DataMember]
  public object[] ElementCells { get; set; }
  public bool IsSelected { get; set; }
 }

 public enum ListContext
 {
  PatientExams, ToBeBilledExamsPublic, NotTransmittedClaimsPublic, TransmittedClaimsPublic, PaidClaimsPublic, InErrorClaimsPublic, ToBeBilledExamsPrivate, NotTransmittedClaimsPrivate, TransmittedClaimsPrivate,
  PaidClaimsPrivate, InErrorClaimsPrivate, NmbListContexts
 }

 public enum AgregationFunction
 {
  None, Average, MinValue, MaxValue, FirstValue, LastValue, Count, Sum, NmbAgregationFunction
 }

 public enum ColumnAlignment
 {
  Left, Right, Center
 }
}

Oliver
Top achievements
Rank 1
 answered on 01 Mar 2012
3 answers
423 views
Hello,
I am using RadToolbar with ItemsSource.
Here is code:
<telerik:RadToolBar   Grid.Row="0" Grid.Column="0"
                          FocusManager.IsFocusScope="False"
                          ItemsSource="{TemplateBinding local:TBaseReadsWn.ExtToolbarButtons}"
                          ItemTemplate="{StaticResource dtToolbarButton}" 
                          HorizontalAlignment="Stretch"
                          VerticalAlignment="Stretch"
                          HorizontalContentAlignment="Left" 
                          VerticalContentAlignment="Center"
                          Padding="30 4 0 4"  >
    </telerik:RadToolBar>

ItemTemplate:
<DataTemplate x:Key="dtToolbarButton" DataType="UICommandItem">
       <Button
          Command="{Binding Command}"
          CommandParameter="{Binding CommandParameter}"
          Margin="{Binding Margins}"
          IsEnabled ="{Binding IsEnabled}"
          ToolTip="{Binding ToolTip}"
          Width = "22"
          Height= "20">
           <Button.Content>
               <Grid>
                   <Grid.ColumnDefinitions>
                       <ColumnDefinition Width="Auto"></ColumnDefinition>
                       <ColumnDefinition Width="Auto"></ColumnDefinition>
                   </Grid.ColumnDefinitions>
                   <Image Grid.Row="0" Grid.Column="0"    Name="img" Style="{StaticResource stlImgBtnIm}"   Source="{Binding Image}"></Image>
                   <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource stlImgBtnTb}" Text="{Binding Text}"></TextBlock>
               </Grid>
           </Button.Content>
       </Button>
       <DataTemplate.Triggers>
           <DataTrigger Binding="{Binding Image}" Value="{x:Null}">
               <DataTrigger.Setters>
                   <Setter TargetName="img" Property="Visibility" Value="Collapsed"></Setter>
               </DataTrigger.Setters>
           </DataTrigger>
 
           <DataTrigger Binding="{Binding Margins}" Value="0">
               <DataTrigger.Setters>
                   <Setter Property="Margin" Value="2 2 2 2"></Setter>
               </DataTrigger.Setters>
           </DataTrigger>
       </DataTemplate.Triggers>
   </DataTemplate>

When I add elements to ExtToolbarButtons collection I see normal - styled buttons.
How to use ItemsSource with  telerik - styled buttons on RadToolbar?
Petar Mladenov
Telerik team
 answered on 01 Mar 2012
2 answers
214 views
This code used to work with an older Telerik release (can verify the version if need be), but no longer works with the latest (RadControls_for_WPF_2012_1_0215_Dev).

Steps to reproduce:
1. Right-click and select the context menu item to add a top-level row.
2. Right-click the row and select the context menu item to add a child row.
3. Right-click the child row, and you get the exception.

TreeListViewRow.ParentRow throws an exception because it tries to do "var parentView = this.Items.ParentView;" but Items is null.

Each top-level (parent) row contains a ParentItem object with a ChildItems property, and the ChildTableDefinition is bound to the ChildItems property. Each child row contains a ChildItem object, which doesn't have a ChildItems property, so when it tries to get the child items for a child row, the collection is null. As a workaround, if I give the ChildItem class a ChildItems property and have it return an empty collection, then the exception goes away. I'm no telerik expert, but it seems strange to me that a row needs to have a non-null collection of child items in order to access the row's parent row.

Apparently you don't let users upload test projects, so here's the source:

MainWindow.xaml:
<Window x:Class="TestTreeListView.MainWindow"
        xmlns:local="clr-namespace:TestTreeListView"
        xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
         
        Name="mainWindow"
        Title="MainWindow"
        Height="350"
        Width="525">
    
   <Window.CommandBindings>
      <CommandBinding Command="local:MainWindow.AddParentRow" Executed="AddParentRow_Executed" />
   </Window.CommandBindings>
    
   <Window.Resources>
 
      <!-- The style of the expand button in the totally rad tree. -->
      <Style x:Key="ExpandButtonStyle" TargetType="{x:Type telerik:GridViewToggleButton}">
         <Setter Property="PresentationMode" Value="PlusMinus"/>
      </Style>
 
      <!-- Context menu for adding a child row to a parent row. -->
      <ContextMenu x:Key="ParentRowContextMenu">
         <ContextMenu.CommandBindings>
            <CommandBinding Command="local:MainWindow.AddChildRow" Executed="AddChildRow_Executed" />
         </ContextMenu.CommandBindings>
         <MenuItem Command="local:MainWindow.AddChildRow" />
      </ContextMenu>
 
      <!-- A sorted view of the totally rad tree items. -->
      <CollectionViewSource x:Key="TotallyRadItemsView"
                            Source="{Binding ElementName=mainWindow, Path=ParentItems}">
         <CollectionViewSource.SortDescriptions>
            <scm:SortDescription PropertyName="Name" />
         </CollectionViewSource.SortDescriptions>
      </CollectionViewSource>
 
   </Window.Resources>
    
   <Grid>
      <telerik:RadTreeListView Name="totallyRadTreeListView"
                               AutoGenerateColumns="True"
                               GridLinesVisibility="None"
                               RowIndicatorVisibility="Collapsed"
                               IsFilteringAllowed="False"
                               CanUserSortColumns="False"
                               HierarchyExpandButtonStyle="{StaticResource ExpandButtonStyle}"
                               ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                               ItemsSource="{Binding Source={StaticResource TotallyRadItemsView}}">
 
         <telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildItems}" />
         </telerik:RadTreeListView.ChildTableDefinitions>
 
         <telerik:RadTreeListView.ContextMenu>
            <!-- Context menu for adding a parent row. -->
            <ContextMenu>
               <MenuItem Command="local:MainWindow.AddParentRow"
                         CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" />
            </ContextMenu>
         </telerik:RadTreeListView.ContextMenu>
      </telerik:RadTreeListView>
   </Grid>
</Window>

MainWindow.xaml.cs:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
 
using Telerik.Windows.Controls.GridView;     // for RowLoadedEventArgs
using Telerik.Windows.Controls.TreeListView; // for TreeListViewRow
 
namespace TestTreeListView
{
   /// <summary>
   /// Interaction logic for MainWindow.xaml
   /// </summary>
   public partial class MainWindow : Window
   {
      public MainWindow()
      {
         InitializeComponent();
 
         // RadTreeListView doesn't select its items on right-click, so add
         // an event handler that accomplishes this.
         mTreeItemClickHandler = new MouseButtonEventHandler( TotallyRadTreeListViewRow_MouseRightButtonDown );
         totallyRadTreeListView.RowLoaded += new EventHandler<RowLoadedEventArgs>( TotallyRadTreeListView_RowLoaded );
         totallyRadTreeListView.RowUnloaded += new EventHandler<RowUnloadedEventArgs>( TotallyRadTreeListView_RowUnloaded );
      }
 
      static MainWindow()
      {
         AddParentRow = new RoutedUICommand( "Add Parent Row", "AddParentRow", typeof( MainWindow ) );
         AddChildRow = new RoutedUICommand( "Add Child Row", "AddChildRow", typeof( MainWindow ) );
      }
 
      public static RoutedUICommand AddParentRow { get; set; }
      public static RoutedUICommand AddChildRow { get; set; }
 
      public ObservableCollection<ParentItem> ParentItems { get { return mParentItems; } }
 
      private void TotallyRadTreeListViewRow_MouseRightButtonDown( object sender, MouseButtonEventArgs e )
      {
         TreeListViewRow row = sender as TreeListViewRow;
         row.IsSelected = true;
 
         // Throws an exception when right-clicking a child row.
         if ( row.ParentRow != null )
         {
            // use row.ParentRow.Item here
         }
 
         // Show the context menu whenever a parent row is clicked.
         if ( row.Item is ParentItem )
         {
            ContextMenu menu = FindResource( "ParentRowContextMenu" ) as ContextMenu;
            menu.IsOpen = true;
         }
      }
 
      private void TotallyRadTreeListView_RowLoaded( object sender, RowLoadedEventArgs e )
      {
         if ( e.Row.Item != null )
         {
            e.Row.MouseRightButtonDown += mTreeItemClickHandler;
         }
      }
 
      private void TotallyRadTreeListView_RowUnloaded( object sender, RowUnloadedEventArgs e )
      {
         e.Row.MouseRightButtonDown -= mTreeItemClickHandler;
      }
 
      private void AddParentRow_Executed( object target, ExecutedRoutedEventArgs e )
      {
         mParentItems.Add( new ParentItem() );
      }
 
      private void AddChildRow_Executed( object target, ExecutedRoutedEventArgs e )
      {
         ParentItem parentItem = totallyRadTreeListView.SelectedItem as ParentItem;
         parentItem.ChildItems.Add( new ChildItem() );
      }
 
      private MouseButtonEventHandler mTreeItemClickHandler = null;
      ObservableCollection<ParentItem> mParentItems = new ObservableCollection<ParentItem>();
   }
 
   public class ParentItem
   {
      public string Name { get { return name; } }
      public ObservableCollection<ChildItem> ChildItems { get { return mChildItems; } }
       
      private string name = "Parent" + i++;
      ObservableCollection<ChildItem> mChildItems = new ObservableCollection<ChildItem>();
 
      private static int i = 0;
   }
 
   public class ChildItem
   {
      public string Name { get { return name; } }
      //public ObservableCollection<ChildItem> ChildItems { get { return mChildItems; } }
 
      private string name = "Child" + i++;
      //ObservableCollection<ChildItem> mChildItems = new ObservableCollection<ChildItem>();
 
      private static int i = 0;
   }
}
Cale
Top achievements
Rank 1
 answered on 01 Mar 2012
4 answers
285 views
Hi,

I'm using Telerik V2011.3.1220.35 and I have a problem with my RadWindow when I set his WindowState property to Maximized.

When I set the WIndowState property to Maximized in my XAML, when my application start, my RadWindow is Maximized and it override my taskbar. 

If I remove the WindowState="Maximized" from my XAML and I set it in the OnLoaded event of my RadWIndow, my RadWindow become Maximized without hidding my taskbar.

In both situations, if I change the AutoHide porperty of my taskbar to TRUE, when my RadWindow become Maximized, I cannot get my taskbar visible just by moving my mouse at the bottom of my screen.

Thank's
Oliver
Top achievements
Rank 1
 answered on 01 Mar 2012
1 answer
111 views
When I put in NumericUpDown minimum value, and I click down button then value of binding variable becomes less then minimum, but control shows right value.
I used this code for initialize in xaml:
<telerik:RadNumericUpDown Name="TopNSpinner" IsEditable="True" Minimum="1" ValueFormat="Numeric"
Value="{Binding Result.TopNEventsCount, Mode=TwoWay}"/>

And this code for initializing in C#:

TopNSpinner.NumberFormatInfo = new NumberFormatInfo() { NumberDecimalDigits = 0 };

So, if I have value is 1 in control, then i can get 0 in variable, but control will show 1.
Please help.
Rosi
Telerik team
 answered on 01 Mar 2012
2 answers
210 views
Dear Telerik Team,

i have a little quest.

I Have a RadScheduleView Control, with an AppointmentDatasource, which get's the Appointments from
a Webservice.

My Problem is, that the Appointments will be loaded by to Webservice calls

Step 1. FreeBusyAppointments
Step 2. ExchangeAppointment Details

Step 1 work very well and very fast, but Step 2. needs a lot of time, because the Backendservers are very slow while fetching the data.

So my solutions ist, that i turn on a busy indicator, loading Step 1 from the Webservice, put the Appointments into the RadschedulerView,
then turn off the busy inidcator and start a backgroundworker which loads the ExchangeAppointment details. When Step 2 is finished
the Appointments will be added to the Rad Scheduleview.

This should give users the possibility to see and user the radscheduleview before all appointment details are loaded.

That's the plan.

The Problem is, that after i turn of the busy indicator and starting the backgroundworker,
i see the freebusy appointments in the radscheduleview, but the busy indicator is also stil shown,
but it hangs up (including the InternetExplorer) until all Appointments from step 2 are loaded and filled into the radscheduleview.

I can easily reproduce this with filling some static Appointments in the RadScheduleview while blocking the Backgroundworker process with a 

System.Threading.Thread.Sleep(xxxx);


Is there any Solution about such a scenario - because the Step 2. can take up to 30 seconds, and the control is unusable during this period

thanks for your help

kind regards
Rudi
Rudolf
Top achievements
Rank 1
 answered on 01 Mar 2012
4 answers
170 views
Hi,

I have problems to use print-method in RadRichTextBox control. E.g when I dynamically load RadRichTextBox to the visual tree and then set the document. This throws an null exception when I call the Print-method.

RadRichTextBox textBox = new RadRichTextBox();
grid.Children.Add(textBox);
textBox.ApplyTemplate();
textBox.UpdateEditorLayout();
textBox.Document = this.CreateDocument();
textBox.Print("MyDoc", PrintMode.Native);  // It crash in here!

CreateDocument returns a valid document, I have tested it by loading it to radRichtextbox without printing.

Hopefully you can see directly what is wrong in my code... if you can provide sample project, that would also help.

 I'm using WPF version of Telerik controls (ver. 2011.2.712.40)

Regards,
Auvo



Iva Toteva
Telerik team
 answered on 01 Mar 2012
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?