Telerik Forums
UI for WPF Forum
1 answer
159 views
I am seeing some really terrible performance when scrolling the grid control and coming to the child grids.  Any suggestions on what I could do to make this scroll as well as the sections with out children?  I load my data and force all of the children to be expanded.  So there should be no computation from my code involved with this issue.( currently using q3 2010 beta )

   <telerik:RadGridView 
ItemsSource="{Binding Fields}" 
x:Name="FieldGridView" 
AutoGenerateColumns="False" 
CanUserInsertRows="False" 
CanUserDeleteRows="False" 
CanUserReorderColumns="False" 
CanUserResizeColumns="False" 
CanUserSelect="True" 
CanUserSortColumns="False" 
ClipboardCopyMode="Cells" 
ShowGroupPanel="False" 
SelectionMode="Extended" 
SelectionUnit="Cell" 
RowIndicatorVisibility="Collapsed" 
ColumnWidth="*" 
GridLinesVisibility="Horizontal" 
EnableColumnVirtualization="True" 
            RowDetailsVisibilityMode="Collapsed" 


ShowColumnHeaders="False"  
            RowLoaded="FieldGridViewChild_RowLoaded"

>
         <telerik:RadGridView.Background>
         <SolidColorBrush/>
         </telerik:RadGridView.Background>
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>

            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView 
                        ItemsSource="{Binding Fields}"  
            x:Name="FieldGridViewChild"  
            AutoGenerateColumns="False" 
            CanUserInsertRows="False"  
            CanUserDeleteRows="False"  
            CanUserReorderColumns="False"  
            CanUserResizeColumns="False"  
            CanUserSelect="True"  
            CanUserSortColumns="False" 
            ClipboardCopyMode="Cells" 
            ShowGroupPanel="False" 
            SelectionMode= "Extended" 
            SelectionUnit="Cell" 
                        RowIndicatorVisibility="Collapsed" 
            ColumnWidth="*" 
            GridLinesVisibility="Horizontal" 
            EnableColumnVirtualization="True" 


            ShowColumnHeaders="False" 
                        >
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn 
                                Header="Id"
                    DataMemberBinding="{Binding ID}"  
                    DataFormatString=""  
                    Width="40"  
                    IsReadOnly="True"
                    Background="#E5E5E5"
                                TextAlignment="Right"  />
                            <telerik:GridViewDataColumn
                                Width="*"  
                                
                                TextWrapping="Wrap"
                                DataMemberBinding="{Binding Value}" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>



            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
Header="Id" 
DataMemberBinding="{Binding ID}" 
DataFormatString="" 
Width="41" TextAlignment="Right"
IsReadOnly="True"  
Background="LightGray" />
                <telerik:GridViewDataColumn
Width="*" 
TextTrimming="None"
                    TextWrapping="Wrap"
DataMemberBinding="{Binding Value}" />
            </telerik:RadGridView.Columns>

        </telerik:RadGridView>
Vlad
Telerik team
 answered on 02 Nov 2010
2 answers
76 views
I'm playing around with radGauge and have encountered the following ArguementNullException:

System.ArgumentNullException occurred
  Message=Value cannot be null.
Parameter name: reference
  Source=PresentationCore
  ParamName=reference
  StackTrace:
       at System.Windows.Media.VisualTreeHelper.HitTest(Visual reference, Point point)
       at Telerik.Windows.Controls.Gauges.GaugeHelper.CheckPointOver(FrameworkElement element, Point point) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2_SP2\Sources\Development\Controls\Gauge\GaugeHelper.cs:line 62
  InnerException:

Here's the xaml code used to produce it.  I'm trying to have a gauge with no numerical legends or tick marks with a 360 degree sweep, going from -180 degrees to 180 degrees, with 0 at the top.

<telerik:RadGauge Name="myGauge" Style="{StaticResource gaugeRadGaugeStyle}" >
    <telerik:RadialGauge>
        <telerik:RadialScale Name="radialScale" Min="-180" Max="180" SweepAngle="360" StartAngle="90" >
            <telerik:RadialScale.Label>
                <telerik:LabelProperties Foreground="Transparent" />
            </telerik:RadialScale.Label>
            <telerik:RadialScale.Ticks>
                <telerik:TickProperties Foreground="Transparent" />
                <!--<telerik:MinorTickProperties Foreground="Transparent" />-->
            </telerik:RadialScale.Ticks>
            <telerik:RangeList>
                <telerik:RadialRange Name="SynchroscopeRange" Style="{StaticResource gaugeRadialRangeStyle}" />
            </telerik:RangeList>
            <telerik:IndicatorList>
                <telerik:Needle Name="needle" IsAnimated="true" Value="{Binding Value}"/>
            </telerik:IndicatorList>
        </telerik:RadialScale>
    </telerik:RadialGauge>
</telerik:RadGauge>

Any insight you can provide would be most appreciated!

Thanks!
Bill G
Andrey
Telerik team
 answered on 02 Nov 2010
2 answers
259 views
I am trying to databind xml nodes to hierarchical treeview. I successfully databinded to the first level of XML data source but cannot correctly databind to second and third level.  I am wondering to find out what I am doing wrong. Any similar sample will be highly appreciated. Is that possible to slide out level3 items horizontally while other levels slide out vertically? Thank you in advance.

Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<Pages xmlns="">
<page name="Name 1" UriSource="Pages/Name1.xaml" />
<page name="Name 2" UriSource="Pages/Name2.xaml" >
  
    <level2 name="ALL1" UriSource="Pages/All1.xaml" />
    <level2 name="ALL2" UriSource="Pages/All2.xaml" />
    <level2 name="ALL3" UriSource="Pages/All3.xaml" />
      
    </page>
    <page name="Name 3" UriSource="Pages/Name3.xaml"/>
        <level2 name="ALL1" UriSource="Pages/All1.xaml" >
            <level3 name="ALL3_1" UriSource="" />
            <level3 name="ALL3_2" UriSource="" />
            <level3 name="ALL3_3" UriSource="" />
        </level2 >  
              
        <level2 name="ALL2" UriSource="Pages/All2.xaml" />
        <level2 name="ALL3" UriSource="Pages/All3.xaml" />
    </page>
      
    <page name="Name 4" UriSource="Pages/Name4.xaml"/>
</Pages>

XAML:
<Window
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
    x:Class="NavPane_2.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480">
      
    <Window.Resources>
        <XmlDataProvider x:Key="PageData" Source="Data/data.xml" XPath="/Pages" />
          
        <HierarchicalDataTemplate x:Key="page" ItemsSource="{Binding XPath=page}"  ItemTemplate="{StaticResource level2}">
            <TextBlock Text="{Binding XPath=@name}" />
       </HierarchicalDataTemplate>
         
        <HierarchicalDataTemplate x:Key="level2" ItemsSource="{Binding XPath=page/level2}" ItemTemplate="{StaticResource level3}">
                <TextBlock Text="{Binding XPath=@name}" />
        </HierarchicalDataTemplate>
  
        <DataTemplate x:Key="level3" ItemsSource="{Binding XPath=page/level2/level3}">
                <TextBlock Text="{Binding XPath=@name}" />
        </DataTemplate>
  
    </Window.Resources>
  
    <Grid x:Name="LayoutRoot">
        <telerikQuickStart:HeaderedContentControl HorizontalAlignment="Center" VerticalAlignment="Center"
            Header="Sample" 
            telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="250"
            Height="350">
  
            <telerik:RadTreeView 
                HorizontalAlignment="Left" Margin="8" Background="#FFF9F9F9"
                IsDragDropEnabled="True" SelectionMode="Multiple" IsSingleExpandPath="True" 
                telerik:StyleManager.Theme="Vista" 
                ItemTemplate="{StaticResource page}" 
                ItemsSource="{Binding Source={StaticResource PageData}, XPath=page}" >
        </telerik:RadTreeView>
        </telerikQuickStart:HeaderedContentControl>
    </Grid>
</Window>

Vlad
Top achievements
Rank 1
 answered on 02 Nov 2010
1 answer
123 views
Hi,

I have a problem about how i can control the dropping an Item before or after the root of the RadTreeView.  In my application, some item are not allowed to be dropped before or after a root (i.e some items can not be roots when I have man roots in the treeView).
I can Control the inside dropping using  "IsDropAllowed"  property of the TreeViewItem.

How can I control the "Before"  and "After" dropping?

Thank U for your help.

Alino
Petar Mladenov
Telerik team
 answered on 01 Nov 2010
5 answers
124 views
Hi. I notice that in the sample provided in the ContextMenu where the .IsInEditMode is kind of buggy. Sometime when you do a right click and select on edit, it will go into edit mode and the text will be wiped out. But there is also times in edit mode the text remains in the textblock. Any solution to it?
Petar Mladenov
Telerik team
 answered on 01 Nov 2010
1 answer
102 views
i have scnerio like wherin i select a item from my listbox and depending upon the tag of the items i want to show different grids like if i select item1 and drag it then i should be able to see the product detail of that item in a radgridview in destination listbox.Would like to get asap as this is like a showstopper for our coming product.have added the xaml and the code behind file for the same.
<Window x:Class="DragandDrop.Window1"
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
   Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <DataTemplate x:Key="ApplicationDragTemplate">
             <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>
                
                <TextBlock Text="{Binding Name}" Grid.Row="0"  VerticalAlignment="Top" />
                <TextBlock Text="{Binding Author}" Grid.Row="1"  VerticalAlignment="Top" />
  
                <!--<telerik:RadGridView x:Name="Info" Grid.Row="0" RowIndicatorVisibility="Collapsed" IsReadOnly="True"
                              ItemsSource="{Binding Path=ApplicationInfo}" ShowGroupPanel="False"
                                     AutoGenerateColumns="False">
  
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Width="110" HeaderTextAlignment="Center" TextAlignment="Left" Header="Name"/>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Author}" Width="80" HeaderTextAlignment="Center"  TextAlignment="Right"  Header="Author"/>
  
  
  
                </telerik:RadGridView.Columns>
  
            </telerik:RadGridView>-->
                  
            </Grid>
              
        </DataTemplate>
        <Style TargetType="ListBoxItem" x:Key="draggableItemStyle">
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="Foreground" Value="#000000" />
            <Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
        </Style>
        </Window.Resources>
      
        <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200" />
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <!--All Applications-->
        <telerikQuickStart:HeaderedContentControl Header="All Applications"
                  
                HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
            <ListBox x:Name="allApplicationsBox" Margin="3" BorderThickness="0"
                    telerik:RadDragAndDropManager.AllowDrop="True" Background="Transparent"
                    ItemContainerStyle="{StaticResource draggableItemStyle}"
                    >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="150">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            
                            <TextBlock Grid.Row="1" Text="{Binding Name}" FontWeight="Bold"
                                    HorizontalAlignment="Center" />
                            <!--<TextBlock Text="{Binding Author}" Grid.Row="2"
                                    HorizontalAlignment="Center" />-->
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </telerikQuickStart:HeaderedContentControl>
        <!--Text-->
        <Border Grid.Column="1" Background="#1f2759" CornerRadius="5" VerticalAlignment="Center"
                HorizontalAlignment="Center">
          
        </Border>
        <!--My Applications-->
        <telerikQuickStart:HeaderedContentControl Header="My Applications"
                HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                Grid.Column="2">
            <ListBox x:Name="myApplicationsBox" Margin="3" Background="Transparent"
                    telerik:RadDragAndDropManager.AllowDrop="True" BorderThickness="0"
                    ItemContainerStyle="{StaticResource draggableItemStyle}"
                    >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel  VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                            <TextBlock Grid.Row="0" Text="{Binding Name}" HorizontalAlignment="Center" />
                             <!--<TextBlock Text="{Binding Author}" HorizontalAlignment="Center" />-->
  
                            <telerik:RadGridView x:Name="View" Grid.Row="1" AllowDrop="True" RowIndicatorVisibility="Collapsed" IsReadOnly="True"
                              ItemsSource="{Binding Path=allApplications}" ShowGroupPanel="False"
                                     AutoGenerateColumns="False">
  
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Width="110" HeaderTextAlignment="Center" TextAlignment="Left" Header="Name"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Author}" Width="80" HeaderTextAlignment="Center"  TextAlignment="Right"  Header="Author"/>
                                </telerik:RadGridView.Columns>
  
                            </telerik:RadGridView
                            </Grid>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <telerik:RadUniformGrid Columns="3" HorizontalAlignment="Left"
                                VerticalAlignment="Top" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </telerikQuickStart:HeaderedContentControl>
    </Grid>
</Window>
using System;
using System.Collections.Generic;
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 System.Collections.ObjectModel;
using Telerik.Windows.Controls.DragDrop;
  
namespace DragandDrop
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
  
        public static ObservableCollection<ApplicationInfo> GenerateApplicationInfos()
        {
            ObservableCollection<ApplicationInfo> result = new ObservableCollection<ApplicationInfo>();
  
            ApplicationInfo info1 = new ApplicationInfo();
            info1.Name = "James Collider";
            info1.Author = "Rockford";
            
            result.Add(info1);
  
            ApplicationInfo info2 = new ApplicationInfo();
            info2.Name = "Alentra";
            info2.Author = "Google.";
           
            result.Add(info2);
  
            ApplicationInfo info3 = new ApplicationInfo();
            info3.Name = "Thomas COOK";
            info3.Author = "Yahoo";
            
            result.Add(info3);
  
            ApplicationInfo info4 = new ApplicationInfo();
            info4.Name = "Britsh Airways";
            info4.Author = "Google";
          
  
            ApplicationInfo info5 = new ApplicationInfo();
            info5.Name = "Trader Joe";
            info5.Author = "Factory";
        
  
            ApplicationInfo info6 = new ApplicationInfo();
            info6.Name = "IE Fox";
            info6.Author = "Open Org";
           
            result.Add(info6);
  
            ApplicationInfo info7 = new ApplicationInfo();
            info7.Name = "Charting";
            info7.Author = "PieChart";
         
            result.Add(info7);
  
            ApplicationInfo info8 = new ApplicationInfo();
            info8.Name = "Batman";
            info8.Author = "Games";
        
            result.Add(info8);
  
            return result;
        }
  
        ObservableCollection<ApplicationInfo> allApplications = GenerateApplicationInfos();
        ObservableCollection<ApplicationInfo> myApplications;
        Brush listBoxDragPossible = new SolidColorBrush(Colors.Orange);
  
        public Window1()
        {
              
            InitializeComponent();
            myApplications = new ObservableCollection<ApplicationInfo>();
            allApplicationsBox.ItemsSource = allApplications;
            myApplicationsBox.ItemsSource = myApplications;
              
            RadDragAndDropManager.AddDragQueryHandler(this, OnDragQuery);
            RadDragAndDropManager.AddDragInfoHandler(this, OnDragInfo);
            RadDragAndDropManager.AddDropQueryHandler(this, OnDropQuery);
            RadDragAndDropManager.AddDropInfoHandler(this, OnDropInfo);
  
  
        }
  
        private void OnDropInfo(object sender, DragDropEventArgs e)
        {
            ItemsControl box = e.Options.Destination as ItemsControl;
            if (box == null) return;
            IList<ApplicationInfo> itemsSource = box.ItemsSource as IList<ApplicationInfo>;
            ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
  
            if (e.Options.Status == DragStatus.DropPossible)
            {
                box.BorderBrush = listBoxDragPossible;
            }
            else
            {
                box.BorderBrush = new SolidColorBrush(Colors.Gray);
            }
  
            if (e.Options.Status == DragStatus.DropComplete)
            {
                if (!itemsSource.Contains(payload))
                {
                    itemsSource.Add(payload);
                }
            }
        }
  
        void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            ItemsControl box = e.Options.Destination as ItemsControl;
            if (box == null) return;
            IList<ApplicationInfo> itemsSource = box.ItemsSource as IList<ApplicationInfo>;
            ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
  
            e.QueryResult = payload != null && !itemsSource.Contains(payload);
        }
  
        void OnDragInfo(object sender, DragDropEventArgs e)
        {
            try
            {
                ListBoxItem listBoxItem = e.Options.Source as ListBoxItem;
                ListBox box = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
                IList<ApplicationInfo> itemsSource = box.ItemsSource as IList<ApplicationInfo>;
                ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
  
                if (e.Options.Status == DragStatus.DragComplete)
                {
                    if (payload != null && itemsSource.Contains(payload))
                    {
                        itemsSource.Remove(payload);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
  
        protected virtual void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            ListBoxItem listBoxItem = e.Options.Source as ListBoxItem;
            ListBox box = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
  
            if (e.Options.Status == DragStatus.DragQuery && box != null)
            {
                e.Options.Payload = box.SelectedItem;
                ContentControl cue = new ContentControl();
                cue.ContentTemplate = this.Resources["ApplicationDragTemplate"] as DataTemplate;
                cue.Content = box.SelectedItem;
                e.Options.DragCue = cue;
                e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
            }
  
            e.QueryResult = true;
        }
    }
  
    public class ApplicationInfo
    {
       // private Double _price;
        private String _name;
        private String _author;
  
         
  
        
  
        public String Name
        {
            get { return this._name; }
            set { this._name = value; }
        }
  
        public String Author
        {
            get { return this._author; }
            set { this._author = value; }
        }
    }
      
}
Tsvyatko
Telerik team
 answered on 01 Nov 2010
1 answer
87 views
Hello,
What would be the best way to bind a tileview to xml data using a HierarchicalDataTemplate?

Best Regards,
Rick
Miro Miroslavov
Telerik team
 answered on 01 Nov 2010
1 answer
49 views
when my chart datasource is nothing it gives me the error
"UIElement.Measure(availableSize) cannot be called with NaN size."
I am using this in dashboard
Waht should i do now to remove this error /


Thanks

Rakhi
Top achievements
Rank 1
 answered on 30 Oct 2010
1 answer
96 views
I have a tileview populated dynamically with a listbox in each tileitem. When a user makes a selection which ever listbox in that tile maximized. I tried to use the same logic as your demo, but it can't see the listbox.

Regards,
Rick
Tina Stancheva
Telerik team
 answered on 29 Oct 2010
2 answers
747 views
How do you get a RadGridView's columns to expand to fill all of the available space of the RadGridView? Right now they are the size of the content inside and no larger and aligned left. I would like them to size fill in some manner.
Ristogod
Top achievements
Rank 2
 answered on 29 Oct 2010
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?