Telerik Forums
UI for WPF Forum
4 answers
117 views
Hello,

I want to perform my own custom logic whenever an item is dragged/dropped. This procedure requires me to access the item's parent. I noticed that when I drag items and then drop them, in the RadTreeView.DragEnded event, the item's ParentItem property becomes null and the FullPath string property is also cleared.

Is this the correct event to handle for my custom logic (i.e. performing the "drop" in the business logic)? If so, how can I get the item's parent before it was dragged (i.e. its current parent).

Thank you.
Ziad
Top achievements
Rank 1
 answered on 14 Jan 2010
1 answer
103 views
Hi There
              We are shift to Q3 Controls but my MouseLeftButtonDown  on GridView doesn't fire. As i have seen the post where this event handle by mouse class of Telerik.Windows.Input namespace but we are not able to find this namespace, there may be version issue. We  use assemblies with  version [2009.3.1103.35]. Please reply me as soon as possible. and if possible submit a demo.
Milan
Telerik team
 answered on 14 Jan 2010
1 answer
248 views
Is it possible to hide the calendar toggle button of the RadDatePicker control?

Regards,
Michael
Konstantina
Telerik team
 answered on 14 Jan 2010
1 answer
306 views
Hello,

I'm using the GridView/HeaderContextMenu example for version 2009.3.1208.35. When i have more columns than displayed on the screen it seems to mix up the contextmenus. Also this line of code IEnumerable<GridViewHeaderCell> cells = row.Cells.OfType<GridViewHeaderCell>(); in the InitializeMenus method doesn't return all of the GridViewHeaderCells.

made a quick example,
<Window x:Class="WpfApplication1.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerk="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:local="clr-namespace:WpfApplication1"
    <Grid> 
        <telerk:RadGridView x:Name="rgv" local:GridViewHeaderMenu.IsEnabled="True" /> 
    </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; 
 
namespace WpfApplication1 
    /// <summary> 
    /// Interaction logic for Window1.xaml 
    /// </summary> 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
 
            ArrayList List = new ArrayList(); 
            for (int i = 0; i < 100; i++) 
            { 
                List.Add(new Testing() 
                { 
                    Test1 = i.ToString(), 
                    Test2 = i, 
                    Test3 = i, 
                    Test4 = i.ToString(), 
                    Test5 = i, 
                    Test6 = i, 
                    Test7 = i.ToString(), 
                    Test8 = i, 
                    Test9 = i, 
                    Test10 = i.ToString(), 
                    Test11 = i, 
                    Test12 = i, 
                    Test13 = i.ToString(), 
                    Test14 = i, 
                    Test15 = i, 
                    Test16 = i.ToString(), 
                    Test17 = i, 
                    Test18 = i 
                }); 
            } 
 
            rgv.ItemsSource = List; 
        } 
    } 
 
    public class Testing 
    { 
        public String Test1 { getset; } 
        public int Test2 { getset; } 
        public Double Test3 { getset; } 
        public String Test4 { getset; } 
        public int Test5 { getset; } 
        public Double Test6 { getset; } 
        public String Test7 { getset; } 
        public int Test8 { getset; } 
        public Double Test9 { getset; } 
        public String Test10 { getset; } 
        public int Test11 { getset; } 
        public Double Test12 { getset; } 
        public String Test13 { getset; } 
        public int Test14 { getset; } 
        public Double Test15 { getset; } 
        public String Test16 { getset; } 
        public int Test17 { getset; } 
        public Double Test18 { getset; } 
    } 
 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.ComponentModel; 
using System.Text; 
using System.Windows; 
using System.Windows.Data; 
using Telerik.Windows; 
using Telerik.Windows.Controls; 
using Telerik.Windows.Controls.GridView; 
using Telerik.Windows.Data; 
 
namespace WpfApplication1 
    public class GridViewHeaderMenu 
    { 
        private RadGridView grid = null
 
        public GridViewHeaderMenu(RadGridView grid) 
        { 
            this.grid = grid; 
        } 
 
        public static readonly DependencyProperty IsEnabledProperty 
            = DependencyProperty.RegisterAttached("IsEnabled"typeof(bool), typeof(GridViewHeaderMenu), 
                new PropertyMetadata(new PropertyChangedCallback(OnIsEnabledPropertyChanged))); 
 
        public static void SetIsEnabled(DependencyObject dependencyObject, bool enabled) 
        { 
            dependencyObject.SetValue(IsEnabledProperty, enabled); 
        } 
 
        public static bool GetIsEnabled(DependencyObject dependencyObject) 
        { 
            return (bool)dependencyObject.GetValue(IsEnabledProperty); 
        } 
 
        private static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) 
        { 
            RadGridView grid = dependencyObject as RadGridView; 
            if (grid != null
            { 
                if ((bool)e.NewValue) 
                { 
                    // Create new GridViewHeaderMenu and attach RowLoaded event. 
                    GridViewHeaderMenu menu = new GridViewHeaderMenu(grid); 
                    menu.Attach(); 
                } 
            } 
        } 
 
        private void Attach() 
        { 
            if (grid != null
            { 
                this.grid.Loaded += new RoutedEventHandler(grid_Loaded); 
            } 
        } 
 
        void grid_Loaded(object sender, RoutedEventArgs e) 
        { 
            GridViewHeaderRow headerRow = grid.ChildrenOfType<GridViewHeaderRow>().FirstOrDefault(); 
            if (headerRow != null
            { 
                InitializeMenus(headerRow); 
            } 
        } 
 
        private void InitializeMenus(GridViewHeaderRow row) 
        { 
            IEnumerable<GridViewHeaderCell> cells = row.Cells.OfType<GridViewHeaderCell>(); 
 
            foreach (GridViewHeaderCell cell in cells) 
            { 
                // create menu 
                RadContextMenu contextMenu = new RadContextMenu(); 
                // set menu Theme 
                StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(grid)); 
 
                RadMenuItem item = new RadMenuItem() { Header = String.Format(@"Sort Ascending by ""{0}""", cell.Column.Header) }; 
                contextMenu.Items.Add(item); 
 
                item = new RadMenuItem() { Header = String.Format(@"Sort Descending by ""{0}""", cell.Column.Header) }; 
                contextMenu.Items.Add(item); 
 
                item = new RadMenuItem() { Header = String.Format(@"Clear Sorting by ""{0}""", cell.Column.Header) }; 
                contextMenu.Items.Add(item); 
 
                item = new RadMenuItem() { Header = String.Format(@"Group by ""{0}""", cell.Column.Header) }; 
                contextMenu.Items.Add(item); 
 
                item = new RadMenuItem() { Header = String.Format(@"Ungroup ""{0}""", cell.Column.Header) }; 
                contextMenu.Items.Add(item); 
 
                item = new RadMenuItem() { Header = "Choose Columns:" }; 
                contextMenu.Items.Add(item); 
 
                // create menu items 
                foreach (GridViewColumn column in grid.Columns) 
                { 
                    RadMenuItem subMenu = new RadMenuItem() 
                    { 
                        Header = column.Header, 
                        IsCheckable = true
                        IsChecked = true 
                    }; 
 
                    // bind IsChecked menu item property to IsVisible column property 
                    subMenu.SetBinding(RadMenuItem.IsCheckedProperty, 
                        new Binding("IsVisible") { Mode = BindingMode.TwoWay, Source = column }); 
 
                    item.Items.Add(subMenu); 
                } 
 
                contextMenu.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClick)); 
 
                // attach menu 
                RadContextMenu.SetContextMenu(cell, contextMenu); 
            } 
        } 
 
        void OnMenuItemClick(object sender, RoutedEventArgs e) 
        { 
            RadContextMenu menu = (RadContextMenu)sender; 
            RadMenuItem clickedItem = ((RadRoutedEventArgs)e).OriginalSource as RadMenuItem; 
            GridViewColumn column = ((GridViewHeaderCell)menu.UIElement).Column; 
 
            if (clickedItem.Parent is RadMenuItem) 
                return
 
            string header = Convert.ToString(clickedItem.Header); 
 
            using (grid.DeferRefresh()) 
            { 
                Telerik.Windows.Data.SortDescriptor sd = (from d in grid.SortDescriptors 
                                                          where d.Member == column.UniqueName 
                                                          select d).FirstOrDefault(); 
 
                if (header.Contains("Sort Ascending")) 
                { 
                    if (sd != null
                    { 
                        grid.SortDescriptors.Remove(sd); 
                    } 
 
                    grid.SortDescriptors.Add(new Telerik.Windows.Data.SortDescriptor() 
                    { 
                        Member = column.UniqueName, 
                        SortDirection = ListSortDirection.Ascending 
                    }); 
                } 
                else if (header.Contains("Sort Descending")) 
                { 
                    if (sd != null
                    { 
                        grid.SortDescriptors.Remove(sd); 
                    } 
 
                    grid.SortDescriptors.Add(new Telerik.Windows.Data.SortDescriptor() 
                    { 
                        Member = column.UniqueName, 
                        SortDirection = ListSortDirection.Descending 
                    }); 
                } 
                else if (header.Contains("Clear Sorting")) 
                { 
                    if (sd != null
                    { 
                        grid.SortDescriptors.Remove(sd); 
                    } 
                } 
                else if (header.Contains("Group by")) 
                { 
                    Telerik.Windows.Data.GroupDescriptor gd = (from d in grid.GroupDescriptors 
                                                               where d.Member == column.UniqueName 
                                                               select d).FirstOrDefault(); 
 
                    if (gd == null
                    { 
                        grid.GroupDescriptors.Add(new Telerik.Windows.Data.GroupDescriptor() { Member = column.UniqueName, SortDirection = ListSortDirection.Ascending }); 
                    } 
                } 
                else if (header.Contains("Ungroup")) 
                { 
                    Telerik.Windows.Data.GroupDescriptor gd = (from d in grid.GroupDescriptors 
                                                               where d.Member == column.UniqueName 
                                                               select d).FirstOrDefault(); 
                    if (gd != null
                    { 
                        grid.GroupDescriptors.Remove(gd); 
                    } 
                } 
            } 
        } 
    } 
 

on my machine if you scroll to the right an open the contextmenu for column Test17 it opens up the contextmenu for Test3.

Any help would be great.
Thanks Again,
~Boots



Stefan Dobrev
Telerik team
 answered on 14 Jan 2010
2 answers
129 views
hi,
i want to perform some action when ever user selects the row header of the grid view,
now problem is that i don't know what is the event name for Telerik GridView.

please, tell me the event name of row header selection by mouse.
thanks
Jorge Gonzalez
Top achievements
Rank 1
 answered on 13 Jan 2010
3 answers
96 views
Hello,
   I am appending an entry to a grid that contains several hundred items. I use ScrollIntoView to scroll the grid to where the item was added but I have not figured out how to hi-light (select) the new entry. The example at this site on how to do this uses constructs that are no longer supported by the latest release. The grid has the SelectAll and UnSelectAll commands so there has to be some command that selects only one row.
Any help would be appreciated.
Thanks
Jorge Gonzalez
Top achievements
Rank 1
 answered on 13 Jan 2010
2 answers
86 views
Hello,
i need to select an item in GridView that his field is starting by text entered by the user.
In other words i have a text box and a grid, the grid is sorted by colomn x.
The text box is a quick seach to the grid and whenever the user enters a text
i need to select an item in Grid that his colomn x starting with the string in my text box.
is there a easy way to do it?

thank you
masha reznik
Top achievements
Rank 1
 answered on 13 Jan 2010
1 answer
197 views
Hi all,

We are testing to buy the library. For this we did a nice prototype in Silverlight to test RadControl.
Now i'm converting the silverlight prototype to WPF to see how the RadControl lib behaves since we have to choose a lib which is 100% compatible with silverlight and WPF. We don't want to wonder each time we do something in silverlight if it is potential broken on WPF.

Currently I'm facing a problem with RadControl and the WPF version of our prototype. Visual Studio saying it can't find reference to some RadControl component.

RadDockPanel
RadDockPanel.Dock
HierarchicalDataTemplate

It logs Erreur    2    Erreur de génération inconnue, 'MC3074 : la balise 'HierarchicalDataTemplate' n'existe pas dans l'espace de noms XML 'clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls'. Ligne 16 Position 10.'  

Erreur    3    Erreur de génération inconnue, 'MC3074 : la balise 'RadDockPanel' n'existe pas dans l'espace de noms XML 'clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls'. Ligne 32 Position 10.' 

Erreur    4    Le type 'telerik:RadDockPanel' est introuvable. Assurez-vous qu'il ne manque aucune référence d'assembly et que tous les assemblys référencés ont été générés. 

I've well added references with all Telerik's references availables.

So my question is why it does not found this telerik components in WPF version?

This raises 2 important questions

1) Do all the Telerik's components available in silverlight are available in WPF ?
2) Do all the Telerik's components have the same naming in both SDK ?


Thank you by advance for your support.

Luciano







Valeri Hristov
Telerik team
 answered on 13 Jan 2010
1 answer
182 views
Hi,

I'm trying to change the theme of a RadWindow from C# but couldn't get it to work. This is my code:

XAML:
<telerikNavigation:RadWindow 
        x:Name="winMainWindow"
... />

C# (Button click event):
StyleManager.SetTheme(this.winMainWindow, new VistaTheme());


Note that the RadWindow is the root element, and my code behind class is inheriting from RadWindow as follow:

public partial class MainWindow : RadWindow
{
...

Miroslav Nedyalkov
Telerik team
 answered on 13 Jan 2010
5 answers
136 views
I just built a sample app with a RadGridView that displays a table of data and has a footer row. For the sample, I'm just summing one column and displaying it in the footer.

Based off another sample from the website, I wanted to export this grid to Excel, however, I'm not getting my footer row to display in the Excel file.

I noticed your ExportElement enum doesn't have FooterRow listed and the ExportElement.Row doesn't seem to pickup footerrows,,,,is  this intentional?

Thanks,
Byron
question_forum
Top achievements
Rank 1
 answered on 13 Jan 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?