Telerik Forums
UI for WPF Forum
5 answers
167 views

Hi

There is a problem in the RadTreeView.

When you rename a node, and the name is longer then the tree’s container width, the tree shakes.

Please try renamning a node with a long name with many ‘a’.

Then rename again the same way, move to a node that has children and the tree will start shaking.

 

Thanks

 

 

Lior Aloni

Kiril Stanoev
Telerik team
 answered on 17 Feb 2010
1 answer
186 views
I subclassed from WPF RadTreeView and created a TreeListView and TreeListViewItem.  I have various controls inside the TreeListViewItem(RadTreeViewItem) that are not functioning properly when I need to interact with them through a mouse drag (ie. selecting text in TextBox, or moving the scrollbar on a combobox dropdown).  The treeview appears to hijack the mouse drag event.  Any ideas on how to fix this? I have attached a jpeg of the control and the problem areas.
Bobi
Telerik team
 answered on 17 Feb 2010
1 answer
164 views
Hi ,

I had changed the Control Template of the tree (see the attached picture) but i had defficulties to add the lines. the code below is the tree template:

any suggestions?


<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
             x:Class="GSTAT.Xeligence.DTM.Client.DTMTemplate" 
             Loaded="UserControl_Loaded" mc:Ignorable="d" 
             xmlns:vsm="clr-namespace:System.Windows;assembly=PresentationFramework">  
    <UserControl.Resources> 
        <ControlTemplate TargetType="{x:Type telerik:RadTreeViewItem}" x:Key="TreeViewItemDefaultTemplate">  
            <ControlTemplate.Triggers> 
                <Trigger Property="IsExpanded" Value="True">  
                    <Trigger.EnterActions> 
                        <BeginStoryboard> 
                            <Storyboard> 
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" 
                                            Storyboard.TargetProperty="Visibility" Duration="0">  
                                    <DiscreteObjectKeyFrame KeyTime="0">  
                                        <DiscreteObjectKeyFrame.Value> 
                                            <Visibility>Visible</Visibility> 
                                        </DiscreteObjectKeyFrame.Value> 
                                    </DiscreteObjectKeyFrame> 
                                </ObjectAnimationUsingKeyFrames> 
                                <DoubleAnimation Storyboard.TargetName="ItemsHost" 
                                            Storyboard.TargetProperty="Opacity" From="0.1" To="1.0" 
                                            Duration="0:0:0.2" /> 
                            </Storyboard> 
                        </BeginStoryboard> 
                    </Trigger.EnterActions> 
                    <Trigger.ExitActions> 
                        <BeginStoryboard> 
                            <Storyboard> 
                                <DoubleAnimation Storyboard.TargetName="ItemsHost" 
                                            Storyboard.TargetProperty="Opacity" From="1" To="0.1" 
                                            Duration="0:0:0.2" /> 
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" 
                                            Storyboard.TargetProperty="Visibility" Duration="0" 
                                            BeginTime="0:0:0.2">  
                                    <DiscreteObjectKeyFrame KeyTime="0">  
                                        <DiscreteObjectKeyFrame.Value> 
                                            <Visibility>Collapsed</Visibility> 
                                        </DiscreteObjectKeyFrame.Value> 
                                    </DiscreteObjectKeyFrame> 
                                </ObjectAnimationUsingKeyFrames> 
                            </Storyboard> 
                        </BeginStoryboard> 
                    </Trigger.ExitActions> 
                </Trigger> 
            </ControlTemplate.Triggers> 
            <Grid Height="Auto" VerticalAlignment="Center" Background="Beige" > 
                <Grid.ColumnDefinitions> 
                    <ColumnDefinition Width="Auto" /> 
                    <ColumnDefinition Width="Auto" /> 
                    <ColumnDefinition Width="Auto" /> 
                </Grid.ColumnDefinitions> 
                <Grid.RowDefinitions> 
                    <RowDefinition Height="Auto" ></RowDefinition>  
                </Grid.RowDefinitions> 
                  
                <!--<Rectangle x:Name="VerticalLine" Fill="Blue" Grid.Column="0" Height="2"></Rectangle> 
                <Rectangle x:Name="HorizontalLine" Fill="Black" Grid.Column="0" Width="2"></Rectangle>--> 
 
                <Grid Grid.Column="1" x:Name="HeaderRow"  Height="Auto" Grid.Row="0" VerticalAlignment="Center" Background="Bisque">  
                    <Grid.ColumnDefinitions> 
                        <ColumnDefinition Width="Auto"></ColumnDefinition> 
                        <ColumnDefinition Width="Auto"></ColumnDefinition> 
                        <ColumnDefinition Width="Auto"></ColumnDefinition> 
                        <ColumnDefinition Width="Auto"></ColumnDefinition> 
                    </Grid.ColumnDefinitions> 
                    <Grid.RowDefinitions> 
                        <RowDefinition Height="Auto"></RowDefinition> 
                    </Grid.RowDefinitions> 
 
                    <ToggleButton x:Name="Expander" Margin="0,0,0,0" Grid.Column="0"></ToggleButton> 
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">  
                        <Border HorizontalAlignment="Center"   
                                            VerticalAlignment="Center"   
                                            CornerRadius="3"   
                                            Background="{DynamicResource BrushWindowDarkGrayBG}"   
                                            Padding="3">  
                            <ContentControl x:Name="Header" 
                                            Content="{TemplateBinding Header}" 
                                            ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                            Width="86.487" Height="13.277" Foreground="White" /> 
                        </Border> 
                    </StackPanel> 
                    <!--<StackPanel x:Name="IndentContainer" Orientation="Horizontal" />--> 
                    <StackPanel x:Name="LoadingVisual" Orientation="Horizontal" /> 
                </Grid> 
                <ItemsPresenter x:Name="ItemsHost" Grid.Column="2" Visibility="Collapsed" Height="Auto" VerticalAlignment="Center">  
                </ItemsPresenter> 
            </Grid> 
        </ControlTemplate> 
 
        <Style TargetType="ToggleButton" x:Key="ExpanderStyle">  
            <Setter Property="IsEnabled" Value="True" /> 
            <Setter Property="IsTabStop" Value="False" /> 
            <Setter Property="Cursor" Value="Hand" /> 
            <Setter Property="Template">  
                <Setter.Value> 
                    <ControlTemplate TargetType="ToggleButton">  
                        <ControlTemplate.Triggers> 
                            <Trigger Property="IsChecked" Value="True">  
                                <Trigger.EnterActions> 
                                    <BeginStoryboard> 
                                        <Storyboard> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="ExpandedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="1" /> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="CollapsedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="0" /> 
                                        </Storyboard> 
                                    </BeginStoryboard> 
                                </Trigger.EnterActions> 
                                <Trigger.ExitActions> 
                                    <BeginStoryboard> 
                                        <Storyboard> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="ExpandedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="0" /> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="CollapsedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="1" /> 
                                        </Storyboard> 
                                    </BeginStoryboard> 
                                </Trigger.ExitActions> 
                            </Trigger> 
                            <Trigger Property="IsEnabled" Value="False">  
                                <Trigger.EnterActions> 
                                    <BeginStoryboard> 
                                        <Storyboard> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="ExpandedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="0" /> 
                                            <DoubleAnimation Duration="0:0:0.2" 
                                                        Storyboard.TargetName="CollapsedStates" 
                                                        Storyboard.TargetProperty="Opacity" To="1" /> 
                                        </Storyboard> 
                                    </BeginStoryboard> 
                                </Trigger.EnterActions> 
                            </Trigger> 
                        </ControlTemplate.Triggers> 
                        <Grid> 
                            <Grid x:Name="CollapsedStates">  
                                <Ellipse x:Name="CollapsedVisual" Width="10" Height="10" Fill="CornflowerBlue"></Ellipse> 
                            </Grid> 
                            <Grid x:Name="ExpandedStates">  
                                <Ellipse x:Name="ExpandedVisual" Width="10" Height="10" Fill="BurlyWood"></Ellipse> 
                            </Grid> 
                        </Grid> 
 
                    </ControlTemplate> 
                </Setter.Value> 
            </Setter> 
        </Style> 
 
        <Style TargetType="{x:Type telerik:RadTreeViewItem}" x:Key="RadTreeViewItemStyle">  
            <Setter Property="Template" Value="{StaticResource TreeViewItemDefaultTemplate}" /> 
            <Setter Property="IsExpanded" Value="True" /> 
            <Setter Property="ItemsPanel">  
                <Setter.Value> 
                    <ItemsPanelTemplate> 
                        <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"/>  
                    </ItemsPanelTemplate> 
                </Setter.Value> 
            </Setter> 
        </Style> 
 
    </UserControl.Resources> 
 
    <Grid> 
                    <telerik:RadTreeView  
                        x:Name="DTMTree" 
                        AllowDrop="True" 
                        IsDragDropEnabled="True" 
                        IsLineEnabled="True" 
                        ExpanderStyle="{StaticResource ExpanderStyle}" 
                        ItemContainerStyle="{StaticResource RadTreeViewItemStyle}" 
                        IsExpandOnSingleClickEnabled="True" 
                        Selected="DTMTree_Selected" 
                        MouseDoubleClick="DTMTree_MouseDoubleClick" 
                        SelectionChanged="DTMTree_SelectionChanged"   
                        Margin="5,0,0,0"   
                        IsRootLinesEnabled="True">  
 
                        <telerik:RadTreeView.ItemsPanel> 
                            <ItemsPanelTemplate> 
                                <StackPanel VerticalAlignment="Center" 
                                    Orientation="Horizontal" 
                                    HorizontalAlignment="Left" /> 
                            </ItemsPanelTemplate> 
                        </telerik:RadTreeView.ItemsPanel> 
 
                        <telerik:RadTreeViewItem Header="Root" 
                            AllowDrop="True"   
                            ItemContainerStyle="{StaticResource RadTreeViewItemStyle}" ForceCursor="True">  
                            <telerik:RadTreeViewItem Header="A" 
                                ItemContainerStyle="{StaticResource RadTreeViewItemStyle}"/>  
                            <telerik:RadTreeViewItem Header="B" 
                                ItemContainerStyle="{StaticResource RadTreeViewItemStyle}"/>  
                        </telerik:RadTreeViewItem> 
                    </telerik:RadTreeView> 
    </Grid> 
</UserControl> 
 
Dimitrina
Telerik team
 answered on 17 Feb 2010
3 answers
134 views
    public partial class MainWindow : Window 
    { 
        public MainWindow() 
        { 
            InitializeComponent(); 
            (Resources["DataSource"as RadTreeViewSampleData).SelectedItem = (radTreeView.ItemsSource as IEnumerable<League>).LastOrDefault(); 
        } 
    } 
    public class League : DependencyObject 
    { 
        public League(string name) 
        { 
            this.Name = name; 
            this.Leagues = new List<League>(); 
        } 
 
        public string Name 
        { 
            get
            set
        } 
 
        public List<League> Leagues 
        { 
            get
            set
        } 
    } 
 
    public class RadTreeViewSampleData : DependencyObject 
    { 
        /// <summary> 
        /// Identifies the SelectedItem dependency property. 
        /// </summary> 
        public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem"typeof(League), typeof(RadTreeViewSampleData)); 
 
        /// <summary> 
        /// Gets or sets SelectedItem.  This is a dependency property. 
        /// </summary> 
        public League SelectedItem 
        { 
            get { return (League)GetValue(SelectedItemProperty); } 
            set { SetValue(SelectedItemProperty, value); } 
        } 
 
        public RadTreeViewSampleData() 
        { 
            this.InitializeLeaguesDataSource(); 
        } 
 
        public List<League> LeaguesDataSource 
        { 
            get
            set
        } 
 
        private void InitializeLeaguesDataSource() 
        { 
            this.LeaguesDataSource = new List<League>(); 
            League l; 
            League d; 
            this.LeaguesDataSource.Add(l = new League("League A")); 
        } 
    } 
<Window.Resources> 
        <local:RadTreeViewSampleData x:Key="DataSource"/> 
    </Window.Resources> 
    <telerik:RadTreeView x:Name="radTreeView" ItemsSource="{Binding Path=LeaguesDataSource, Source={StaticResource DataSource}}" SelectedItem="{Binding Path=SelectedItem, Source={StaticResource DataSource}, Mode=TwoWay}"
        <telerik:RadTreeView.ItemTemplate> 
            <HierarchicalDataTemplate ItemsSource="{Binding Path=Leagues}"
                <TextBlock Text="{Binding Path=Name}" /> 
            </HierarchicalDataTemplate> 
        </telerik:RadTreeView.ItemTemplate> 
    </telerik:RadTreeView> 
The SelectedItem is set properly but does not have the selection brush applied appropriately to its container.
Bobi
Telerik team
 answered on 17 Feb 2010
4 answers
429 views
Hi,

I like to add some copy/paste functionality to the grid.
In the grid contextmenu, I need a applicationcommands.copy and a applicationcommands.paste.
The problem is that the copy command is handled by the grid (for clipboard copy I suppose) and the copy canexecute is not fired in my program. Do you have a solution for this?

Thanks in advance,
Thomas.
Thomas
Top achievements
Rank 1
 answered on 17 Feb 2010
5 answers
161 views
Hi All,

Are there any built in transition effects in the WPF suite? In the demo, there is a transition between categories of demo's.. the panel pulls back and rotates. Are there any existing control like that available with a choice of transition effects?

Thanks
harold

Valeri Hristov
Telerik team
 answered on 17 Feb 2010
1 answer
116 views
Hi,
I've some questions about Doughnut customization. I've created in viewmodel a colection with this 3 properties

Color
Item Title
Item Value

I need to set  that properties in the view (xaml) without using code behind. I would like to put Item Title and Item Value in the item tooltip and color in item background.

I attach the code



<telerik:RadChart Background="Transparent" ItemsSource="{Binding PhoneResultBox}" HorizontalAlignment="Stretch" MaxHeight="230">
     
                <telerik:RadChart.SeriesMappings>
                    <telerik:SeriesMapping>
                       
                        <telerik:SeriesMapping.SeriesDefinition>
 
                        </telerik:SeriesMapping.SeriesDefinition>
              
                    <telerik:SeriesMapping.ItemMappings>
                           <telerik:ItemMapping DataPointMember="YValue" FieldName="ItemsCount"> </telerik:ItemMapping>
                 
                            

                        </telerik:SeriesMapping.ItemMappings>
                        
                      </telerik:SeriesMapping>
                    </telerik:RadChart.SeriesMappings>
           
                <telerik:RadChart.DefaultView>
                    <telerik:ChartDefaultView>
                        <telerik:ChartDefaultView.ChartLegend>
                            <telerik:ChartLegend Visibility="Collapsed" />
                        </telerik:ChartDefaultView.ChartLegend>
                        <telerik:ChartDefaultView.ChartTitle>
                            <telerik:ChartTitle Content="Esiti Telefonici"></telerik:ChartTitle>
                        </telerik:ChartDefaultView.ChartTitle>
                        <telerik:ChartDefaultView.ChartArea>
                            <telerik:ChartArea>
                         
                            </telerik:ChartArea>
                        </telerik:ChartDefaultView.ChartArea>
                    </telerik:ChartDefaultView>
                    
                   
                </telerik:RadChart.DefaultView>

             
            </telerik:RadChart>
Velin
Telerik team
 answered on 17 Feb 2010
10 answers
530 views
Hello

I have a three level hierarchy grid
and I want to open all the expand buttons at once (by a button click)
If I use 

RadGridview1.ExpandAllHierarchyItems()
it opens only the first level
how can I open the second level?
I tried to do this

 

RadGridview1.ChildrenOfType<

RadGridView>().FirstOrDefault().ExpandAllHierarchyItems();
but only the children of the first child are open.

Thanks

 

Pavel Pavlov
Telerik team
 answered on 17 Feb 2010
3 answers
229 views
I have a GridView hierarchy with two child tables, of which I want to show only a few chosen columns .

In Q2, it worked fine with the following code.
 

 

GridViewTableDefinition tdPayment = new GridViewTableDefinition();  
GridViewTableDefinition tdDetail = new GridViewTableDefinition();  
 
tdPayment.DataSource = MySalePayments = GetSalePaymentsData();  
tdPayment.AutoGenerateFieldDescriptors = false;  
 
TableRelation tr = new TableRelation();  
tr.FieldNames.Add(new FieldDescriptorNamePair("Receipt""Receipt"));  
tdPayment.Relation = tr;  
 
GridViewDataColumn paymentType = new GridViewDataColumn();  
paymentType.UniqueName = "SalePaymentType";  
paymentType.Header = "PaymentType";  
paymentType.DataType = typeof(short);  
GridViewDataColumn amount = new GridViewDataColumn();  
amount.UniqueName = "Amount";  
amount.Header = "Amount";  
amount.DataType = typeof(decimal);  
 
tdPayment.FieldDescriptors.Add(paymentType);  
tdPayment.FieldDescriptors.Add(amount);  
           
tdDetail.AutoGenerateFieldDescriptors = false;           
tdDetail.DataSource = MySaleDetails = GetSaleDetailData();  
 
tdDetail.Relation = tr;  
GridViewDataColumn itemId = new GridViewDataColumn();  
itemId.UniqueName = "ItemId";  
itemId.Header = "ItemId";  
itemId.DataType = typeof(string);  
GridViewDataColumn saleQty = new GridViewDataColumn();  
saleQty.UniqueName = "SaleQuantity";  
saleQty.Header = "Sale Qty";  
saleQty.DataType = typeof(short);  
GridViewDataColumn unitPrice = new GridViewDataColumn();  
unitPrice.UniqueName = "UnitPrice";  
unitPrice.Header = "Price";  
unitPrice.DataType = typeof(decimal);  
GridViewDataColumn discount = new GridViewDataColumn();  
discount.UniqueName = "Discount";  
discount.Header = "Discount";  
discount.DataType = typeof(decimal);  
GridViewDataColumn individualDiscount = new GridViewDataColumn();  
individualDiscount.UniqueName = "IndividualDiscount";  
individualDiscount.Header = "Ind.Discount";  
individualDiscount.DataType = typeof(decimal);  
 
tdDetail.FieldDescriptors.Add(itemId);  
tdDetail.FieldDescriptors.Add(saleQty);  
tdDetail.FieldDescriptors.Add(unitPrice);  
tdDetail.FieldDescriptors.Add(discount);  
tdDetail.FieldDescriptors.Add(individualDiscount);  
 
radGridViewSalesList.TableDefinition.ChildTableDefinitions.Add(tdPayment);  
radGridViewSalesList.TableDefinition.ChildTableDefinitions.Add(tdDetail);  
 

 

When Run in Q3, AutoGenerateFieldDescriptors was simply ignored showing all columns.

In Q3, it was suggested that I use AutoGenerateColumns of GridViewDataControl .
I was able to do it with single child table using DataLoading handler as shown in the demo source code.
But I don't know how to do it with two child tables.

gureumi
Top achievements
Rank 1
 answered on 16 Feb 2010
5 answers
146 views
I have implemented a similar search/filter as the scenario found at http://demos.telerik.com/wpf/?GridView/Search , the same behaviour occurs in my own implementation and in the demo itself.

The search while you type works perfectly when a grid row is not selected, however if a row is selected, and a search is started, the row receives the focus.

This occurs only when a matching letter is found within the selected row. The textbox looses focus, which means only the first letter is searched on.

If a match isn't found, the focus remains in the search textbox and more letters can be added to the search.

On a side note, is there any way to ensure the search textbox has the focus when the filter is removed? Eg. When a user deletes his search, the grid immediatly takes focus from the textbox.

Thank you,

A Marshall

Hristo
Telerik team
 answered on 16 Feb 2010
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?