Telerik Forums
UI for WPF Forum
8 answers
420 views
Hi,

I want to know the equivalent mecanism in WPF to bind Property  of the TreeView and TreeViewItems with properties in the ViewModel using MVVM pattern. For Example in silverlight  I do such and work perfectly:

<telerik:ContainerBindingCollection x:Name="BindingProperties">
   <telerik:ContainerBinding PropertyName="IsLoadOnDemandEnabled" Binding="{Binding Path=Expand, Mode=TwoWay}" />
 <telerik:ContainerBinding PropertyName="IsDropAllowed" Binding="{Binding Path=DropAllowed, Mode=TwoWay}"/>
</telerik:ContainerBindingCollection>

But this one doesn t work in WPF. Can U tell me how to adapt this in the WPF context??

Thank U for your Help

Alino
Tina Stancheva
Telerik team
 answered on 22 Nov 2011
1 answer
195 views

I dynamically built a form using a RadDocking, then a Vertical RadSplitContainer and inside the RadSpltContainer two Horizontal RadSplitContainers. The lower RadSplitContainer has three RadPaneGroups where the right outer contains three RadPanes.
The right outer container is filled like this:

radPaneGroupSystem.AddItem(ucStatusAlarms, Telerik.Windows.Controls.Docking.DockPosition.Top);
radPaneGroupSystem.AddItem(ucRSSFeed, Telerik.Windows.Controls.Docking.DockPosition.Left);
radPaneGroupSystem.AddItem(ucMessageViewer, Telerik.Windows.Controls.Docking.DockPosition.Right);

If I do that I get a "Object reference not set to an instance of an object." error, source "Telerik.Windows.Controls.Docking",
StackTrace   
at Telerik.Windows.Controls.RadPaneGroup.GetPaneGroup()
at Telerik.Windows.Controls.RadPaneGroup.AddItem(RadPane pane, DockPosition dockPosition)

If I change the code and use panegroupParent.Items.Add(ucStatusAlarms), etc I get the three RadPanes as three Tabs functioning normally.

I checked the parameters going into the AddItem call, they are normally set to an instance.
Does anyone know why the Docking gives an Object reference not set to an instance of an object error and what I can do about it?

Pieter
Top achievements
Rank 2
 answered on 22 Nov 2011
1 answer
176 views
Hi,

I am using MaskedInput control for currency value. I want to set a negative currency value in the masked input control. I get () in the control when I type - symbol. How to set mask which accepts negative value for currency type.

Regards,
Jeyakumar
Petar Mladenov
Telerik team
 answered on 22 Nov 2011
6 answers
242 views
Hi,

I am using RadGridView with multiple/single field groupings based on conditions. When grid is first bound, it eats away first row of each group, which is event present in the datasource of the grid.

Code for setting default grouping when RadGridView is bound:
private void setGrouping() {
       if (this.grdScope != null) {
           this.grdScope.GroupDescriptors.Clear();
           GroupDescriptor serviceDescriptor = new GroupDescriptor();
           serviceDescriptor.Member = "Service";
           serviceDescriptor.SortDirection = ListSortDirection.Ascending;
           this.grdScope.GroupDescriptors.Insert(0, serviceDescriptor);
       }
   }

Edited: The missing row is restored when I toggle the radio buttons to change the mode (as below)
Below is the code to change the grouping:

//if radiobutton 1 is checked
private void rbService_Checked(object sender, RoutedEventArgs e) {
       if (this.grdScope != null) {
            this.grdScope.GroupDescriptors.Clear();
            GroupDescriptor serviceDescriptor = new GroupDescriptor();
            serviceDescriptor.Member = "Service";
            serviceDescriptor.SortDirection = ListSortDirection.Ascending;
            this.grdScope.GroupDescriptors.Insert(0, serviceDescriptor);
        }
    }
 
//if radiobutton 2 is checked
    private void rbPhase_Checked(object sender, RoutedEventArgs e) {
        if (this.grdScope != null) {
            GroupDescriptor phaseDescriptor = new GroupDescriptor();
            phaseDescriptor.Member = "Phase";
            phaseDescriptor.SortDirection = ListSortDirection.Ascending;
            this.grdScope.GroupDescriptors.Insert(0, phaseDescriptor);
            this.grdScope.ShowGroupPanel = false;
        }
    }

Any ideas suggestions on this?
Maya
Telerik team
 answered on 22 Nov 2011
2 answers
218 views
Hi,

I have a WPF application in which I rehost the .Net 4.0 Workflow designer alongside a RadTreeView. Items on the RadTreeView are dragged onto the designer and, when dropped, morph into self configuring workflow activities based on the context from which they were dragged.

I am using Telerik's DragDropManager and the AddDragEnterHandler and AddDragOverHandler methods to add handlers to the Workflow Designer View and that is working perfectly. However...

I need to control the drag cue over the designer and that is proving to be more problematic.

I first tried the following:
RadDragAndDropManager.AddDragQueryHandler(this.Designer.View, this.Designer_DragQueryHandler);

However the Designer_DragQueryHandler delegate would never fire.

So I thought it must be that the designer is handling that event before my delegate can be executed, so I tried the following:
this.Designer.View.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(this.Designer_DragQueryHandler), true);

This did not work either.

I am at a dead end on this now and would greatly appreciate any direction on how I might achieve this.

Thanks in advance
Chris
Chris
Top achievements
Rank 1
 answered on 22 Nov 2011
0 answers
67 views
We are using autogenerated gridview and works fine but we have an issue with rebinding itemssource of filtered (by column default filters) by user.
If you refresh data (we do with background worker as datatable, then set grid itemsource to dataview.defaultview and call grid.rebind()) if the user has set column filters, it looses the ability to remove the filter but still reflects the filter in the grid.
Guru
Top achievements
Rank 2
 asked on 22 Nov 2011
1 answer
328 views

Hi,

 

We are using RadRibbonView that contains RibbonTab with a number of Ribbon Groups.  I want to show a textbox (for search functionality) and I want to be aligned to the right of the ribbon view.   If I added this textbox inside a spate Ribbon Group, then that group is appended to the rest of the group, and not aligned to the right.  Also, I tried to create a grid inside the Ribbon tab and set all the group on one column, and then have that textbox on the second  column, but apparently Ribbon Tabs doesn’t accept Grid inside, I got a run time error.

 

Any idea how I can achieve this?!

 

Regards

Petar Mladenov
Telerik team
 answered on 21 Nov 2011
3 answers
116 views
In our application we use attached behaviors on RadControls in a number of places to avoid code-behind (mvvm pattern). These are used for some custom validation logic in grids, automatic significant digits displays on NumericUpDowns, and many others. After updating to the latest release (2011.3.1116.35) the following error occurs on all of these behaviors:

Cannot add content of type 'Behaviors.DynamicDecimalDigitsBehavior' to an object of type 'System.Windows.Interactivity.BehaviorCollection'.  Error at object 'Behaviors.DynamicDecimalDigitsBehavior' in markup file 'setdatarenderingpropertiesview.xaml' Line 270 Position 22.

The project is built in .Net 3.5, and as such we reference System.Windows.Interactivity version 3.5.0.0. 
Devlin
Top achievements
Rank 1
 answered on 21 Nov 2011
6 answers
107 views
Hello,

I am prototyping a user interface.  Basic slimmed down requirements are that I have a list of items on left side of page for the user to select.  On the right side of the list there will be a large view that contains information about the item that was selected in the list.  I have put together UI like this many times and also have used many telerik controls in our applications.  The TileView caught my eye for this one, thinking that I may be able to have something that serves the purpose and provides a bit of modern look and feel rather than just a list.

I practice MVVM and use prism with unity injection.

So what I am looking to get from this control is a templated list of items on left side in a single column.  When one is selected a templated view of the information related to the selection animates (maximizes) over to the right.  I do not want to ever have the items in a tiled view with several columnns and I do not want to have to Maximize in order to see information on the right side. 

Can you let me know if I am going to be able to achieve this functionality with the control?  In addition, if this is possible, could you provide a simple example for me to download?

Thanks,

Jason Munger
Osmose
Avrohom Yisroel
Top achievements
Rank 1
 answered on 21 Nov 2011
7 answers
748 views
Exception : {"'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D."}

My XAML:

<telerik:RadTreeView  ItemsSource="{Binding Doklad.polozky}">
  
  
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                                <TextBlock Grid.Column="2">
                                    <Hyperlink TextDecorations="None" 
                                               Command="{Binding EditPolozkaCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
                                               CommandParameter="{Binding}">    
                                    <Image  Grid.Column="2"  Width="16" Source="/Assets/Icons/Edit.png" Cursor="Hand"/>
                                    </Hyperlink>
                                </TextBlock>
  
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
  
                </telerik:RadTreeView>



StackTrace:

   at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at MS.Internal.Media.VisualTreeUtils.AsNonNullVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
   at Telerik.Windows.Controls.ParentOfTypeExtensions.GetParent(DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 85
   at Telerik.Windows.Controls.ParentOfTypeExtensions.<GetParents>d__0.MoveNext() in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 77
   at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Telerik.Windows.Controls.ParentOfTypeExtensions.ParentOfType[T](DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 21
   at Telerik.Windows.Controls.ParentOfTypeExtensions.GetParent[T](DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 64
   at Telerik.Windows.Controls.RadTreeView.OnLostFocus(Object sender, RoutedEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\Navigation\TreeView\RadTreeView.cs:line 1437
   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 e)
   at System.Windows.UIElement.OnLostFocus(RoutedEventArgs e)
   at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
   at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
   at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
   at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)
   at System.Windows.FrameworkContentElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
   at System.Windows.Input.KeyboardFocusChangedEventArgs.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.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
   at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
   at System.Windows.ContentElement.Focus()
   at System.Windows.Documents.Hyperlink.OnMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
   at System.Windows.Documents.Hyperlink.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonDownThunk(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.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseDownThunk(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.RaiseTrustedEvent(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, WindowMessage 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, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Petar Mladenov
Telerik team
 answered on 21 Nov 2011
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?