Telerik Forums
UI for WPF Forum
1 answer
62 views
I have a collection which contains two properties
1. ABC
2. XYZ

I want to make XYZ as the child of ABC For example:

.ABC1
    .XYZ1
    .XYZ2
.ABC2
    .XYZ3
    .XYZ4

I want to bind this in .XAML.CS page

Currently what I have done in XAML

 

<Telerik:RadTreeView x:Name="RadTreeView" DockPanel.Dock="Bottom"/>

 

 


In XAML.CS page
Collection is CommodityCollection

RadTreeViewItem

aa;

 

 

 

 

 

for (int i = 0; i < CommodityCollection.Count; i++) {

 

aa = new RadTreeViewItem();

 

 

 aa.Header = CommodityCollection[i].ABC;

 

this.RadTreeView.Items.Add(aa);


Now my problem is How to add child node in the RadTreeView?

 

 





Valentin.Stoychev
Telerik team
 answered on 30 Jan 2009
4 answers
99 views
Hi..
What event is fired when the carousel is 'moved' either by MoveBy or using the Horiz/Vertical  scrollbars?
Can the scrollbars be customized?
Thanks again.!
Nor
Top achievements
Rank 1
 answered on 29 Jan 2009
1 answer
153 views
Hi,
I've created a simple solution to test the RadTreeview.It just initializes a new ObservableCollection of Items like this:
 /// <summary> 
    /// Interaction logic for Window1.xaml 
    /// </summary> 
    public partial class Window1 : Window 
    { 
        public ObservableCollection<Item> Items 
        { 
            get { return (ObservableCollection<Item>)GetValue(ItemsProperty); } 
            set { SetValue(ItemsProperty, value); } 
        } 
 
        // Using a DependencyProperty as the backing store for Items.  This enables animation, styling, binding, etc... 
        public static readonly DependencyProperty ItemsProperty = 
            DependencyProperty.Register("Items"typeof(ObservableCollection<Item>), typeof(Window1)); 
 
        public Window1() 
        { 
            InitializeComponent(); 
            Items = new ObservableCollection<Item>(); 
 
            Items.Add(new Item("Item 1")); 
            Items.Add(new Item("Item 2")); 
            Items.Add(new Item("Item 3")); 
        } 
    } 
 
    public class Item 
    { 
        public string Header { getset; } 
        public ObservableCollection<Item> Items { getset; } 
 
        public Item(string header) 
        { 
            Header = header; 
            Items = new ObservableCollection<Item>(); 
        } 
    } 

and in xaml created a simple HierarchicalDataTemplate:
<Window.Resources> 
        <HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding Path=Items}"
            <StackPanel Orientation="Horizontal"
                <TextBlock Text="{Binding Path=Header}"/> 
            </StackPanel> 
        </HierarchicalDataTemplate> 
    </Window.Resources> 
    <Grid> 
        <Telerik:RadTreeView IsDragDropEnabled="True" Name="t"  
                             ItemsSource="{Binding Path=Items, ElementName=window}"  
                             ItemTemplate="{StaticResource NodeTemplate}"
        </Telerik:RadTreeView> 
    </Grid> 

Now, when I am trying to drag "Item 1" to, lets say, "Item 2" it works ok. But if afterwards I am trying to drag "Item 3" to "Item 1" (that is now under "Item 2") I am getting a NullReferenceException with the following stack trace:
   at Telerik.Windows.Controls.RadTreeViewItem.CheckStatePropertyChangedConstrainValue(DependencyObject d, Object newValue) 
   at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean skipBaseValueChecks) 
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) 
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal) 
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) 
   at Telerik.Windows.Controls.RadTreeViewItem.set_CheckState(ToggleState value) 
   at Telerik.Windows.Controls.RadTreeViewItem.SetCheckStateWithNoPropagation(ToggleState state) 
   at Telerik.Windows.Controls.RadTreeViewItem.Render(Boolean recursive) 
   at Telerik.Windows.Controls.RadTreeViewItem.OnItemsChanged(NotifyCollectionChangedEventArgs e) 
   at System.Windows.Controls.ItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) 
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) 
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) 
   at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) 
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list) 
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args) 
   at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) 
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) 
   at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex) 
   at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) 
   at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) 
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) 
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item) 
   at System.Collections.ObjectModel.Collection`1.Add(T item) 
   at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Add(Object value) 
   at Telerik.Windows.Controls.RadTreeView.EndDrag() 
   at Telerik.Windows.Controls.RadTreeView.HandleMouseUp(MouseEventArgs e) 
   at Telerik.Windows.Controls.RadTreeView.RadTreeView_MouseLeftButtonUp(Object sender, MouseEventArgs e) 
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) 
   at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e) 
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) 
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) 
   at System.Windows.Input.InputManager.ProcessStagingArea() 
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) 
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) 
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) 
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) 
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
   at System.Windows.Threading.Dispatcher.Run() 
   at System.Windows.Application.RunDispatcher(Object ignore) 
   at System.Windows.Application.RunInternal(Window window) 
   at System.Windows.Application.Run(Window window) 
   at System.Windows.Application.Run() 
   at Telerik.App.Main() in C:\Documents and Settings\talg\Desktop\TreeViewDrag\Telerik\Telerik\obj\Debug\App.g.cs:line 0 
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
   at System.Threading.ThreadHelper.ThreadStart() 

To make things even worse, it's not constant. It happens in about 50% of the tries.
Thank you in advance,
Tal
Ivan
Telerik team
 answered on 29 Jan 2009
1 answer
174 views
Just installed WPF with VS2008.
Want to get GridView to work.
I installed the .dlls in the toolbox as described here: http://www.telerik.com/help/wpf/adding-radcontrols-to-vs-toolbox.html

The following is what I pieced together from the online demo:

<Page x:Class="TestGridViewAggregate.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    Title="Page1">
    <Grid>
       <telerik:RadGridView></RadGridView>
    </Grid>
</Page>

However, it gives me the error:
"The tag 'RadGridView' does not exist in XML namespace clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView'"
Vlad
Telerik team
 answered on 28 Jan 2009
1 answer
94 views
Hi! Is it possible to change sort logic for grid? For example user apply sorting by some column, but i need to leave one row unsorted (in the end of list).
Vlad
Telerik team
 answered on 28 Jan 2009
1 answer
115 views
Hi,
I am looking for a vertical navigator control like the navigator on the telerik site or many other sites. I found PanelBar, but Implements this control ICommandSource, so I am able to associate ICommand items with it??
Can I load the content via data binding?

With best regards

Gerhard
Tihomir Petkov
Telerik team
 answered on 27 Jan 2009
1 answer
1.3K+ views
Hello!

Currently i am working on an application wich needs two datepickers - a StartDate and an EndDate . I am having problems binding this two controls with DateTime properties on an object . For binding values i am using the attribute SelectedDate = {Binding Path=StartDate}, but no binding is created . I would like to know if this is the correct way of binding this control to date fields or if there is another way of doing this... I have search throught the website/documentation but I can't find a proper response.

Any help would be great !
Thanks,
Ivan Frias.

Miroslav Nedyalkov
Telerik team
 answered on 27 Jan 2009
1 answer
363 views
Hi !
I would like to know if it's possible to define the initial date, some sort of default value for this control . I have searched through the properties list and I can't find it .Also I searched through the documentation and found nothing ..
Hope you could help, with an example or point me to the right direction .

Thanks,
Ivan Frias
Miroslav Nedyalkov
Telerik team
 answered on 27 Jan 2009
1 answer
74 views
I have a radcarousel bound to an objectdataprovider which has an instance of an observablecollection<T> where T is a personentity class in my system. If I change a property value of one of the personentity (like firstname) those changes are not reflected in the Carousel. Any help will be much appreciated.

Matt Francis
Top achievements
Rank 1
 answered on 26 Jan 2009
3 answers
212 views
Hello,

I'm having an issue where the column header is missing when you add a column to the grid after it has initially been created.  I have created a sample project that demonstrates my issue, but it appears I can't attach it so I included the code at the end of this post.  To reproduce it, just click on the 'Add Column' button.  Am I doing something wrong in my code or is this a bug?

In my example I'm also calling Rebind() and UpdateLayout() on the grid after adding the column because if I don't then no data appears in the column, though the column itself is added.

Note: I borrowed the Custom and Order classes from a sample app on this forum.

Thanks,

Joel


Window1.xaml
<Window x:Class="AddColumnIssue.Window1" 
    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" 
    Title="Window1" Height="380" Width="701"
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="30" /> 
            <RowDefinition Height="*" /> 
        </Grid.RowDefinitions> 
         
        <Button x:Name="AddColumnButton" Grid.Row="0" Height="23" Width="75" Click="AddColumnButton_Click" >Add Column</Button> 
         
        <telerik:RadGridView x:Name="ItemsGrid" Grid.Row="1" ItemsSource="{Binding}" AutoGenerateColumns="False" /> 
    </Grid> 
</Window> 

Window1.cs
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
            AddColumns(); 
            this.DataContext = BuildCustomers(); 
        } 
 
        private void AddColumnButton_Click(object sender, RoutedEventArgs e) 
        { 
            AddColumn(typeof(string), "Email", 200); 
            RefreshGrid(); 
        } 
 
        private void AddColumns() 
        { 
            AddColumn(typeof(int), "Number", 100); 
            AddColumn(typeof(string), "Name", 100); 
        } 
 
        private void AddColumn(Type dataType, string name, int width) 
        { 
            GridViewDataColumn column = new GridViewDataColumn(); 
            column.DataType = dataType; 
            column.HeaderText = name; 
            column.UniqueName = name; 
            column.Width = new GridLength(width); 
            column.IsReadOnly = true
 
            ItemsGrid.Columns.Add(column); 
        } 
 
        private void RefreshGrid() 
        { 
            ItemsGrid.Rebind(); 
            ItemsGrid.UpdateLayout(); 
        } 
 
        private static ObservableCollection<Customer> BuildCustomers() 
        { 
            ObservableCollection<Customer> customers = new ObservableCollection<Customer>(); 
            ObservableCollection<Order> orders = new ObservableCollection<Order>(); 
 
            for (int i = 0; i < 10; i++) 
                orders.Add(new Order { Number = i, Details = "Order" + i }); 
 
            for (int i = 0; i < 100; i++) 
                customers.Add(new Customer { Email = "Mail" + i, Name = "Name" + i, Number = i, Orders = orders }); 
 
            return customers; 
        } 
    } 

Milan
Telerik team
 answered on 26 Jan 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?