Telerik Forums
UI for WPF Forum
1 answer
106 views
The Silverlight Q1 2010 installer included a nice Themes project that allowed easy access to the different themes.  This is great for creating custom themes using a Telerik theme as a starting point.

How can I get the themes for the WPF controls?
Kalin Milanov
Telerik team
 answered on 11 Mar 2010
1 answer
107 views
Hi,
I am facing problem with my tree control, that i collapse the tree and dragged an item below the tree i.e. on blank part of the tree, it show the drag drop tooltip and drop preview line on the blank part of tree. It seems that items are not collapsing properly. i captured the collapse event and calling the tree item's collapseAll method but the problem still persist.
i unable to find the reason.

Thanks
Balaram Barange
Vladislav
Telerik team
 answered on 11 Mar 2010
3 answers
166 views
Hi. I placed a TileView control in my XAML page, and it compiles fine and I can see the control at design time. However, when the page loads at runtime, I get the exception follwoing exception:

Object reference not set to an instance of an object.

at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.FindRootVisual() at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.Initialize() at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.OnAllowDragChanged(DependencyObject sender, 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, 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.DragDrop.RadDragAndDropManager.SetAllowDrag(DependencyObject obj, Boolean value) at Telerik.Windows.Controls.RadTileViewItem.OnApplyTemplate() at System.Windows.FrameworkElement.ApplyTemplate() at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Canvas.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Designer.SimpleViewManager.DesignerBackground.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Interop.HwndSource.SetLayoutSize() at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at System.Windows.Interop.HwndSource.set_RootVisual(Visual value) at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize() at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content) at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle() at MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle() at MS.Internal.Designer.DesignerPane.LoadDesignerView()

My TileView's XAML is this:




<NavigationControls:RadTileView Grid.ColumnSpan="4" Name="radTileView1" Grid.Row="1" 
                                Margin="5" Width="800" Height="450" MinimizedColumnWidth="150"
    <NavigationControls:RadTileViewItem> 
        <NavigationControls:RadTileViewItem.Header> 
            <TextBlock Text="Vehículo header"></TextBlock> 
        </NavigationControls:RadTileViewItem.Header> 
        <NavigationControls:RadTileViewItem.Content> 
            <Controls:RadFluidContentControl AnimationControls:AnimationManager.IsAnimationEnabled="True" 
                                             SmallToNormalThreshold="291,130" 
                                             NormalToSmallThreshold="292,131" 
                                             NormalToLargeThreshold="735,350" 
                                             LargeToNormalThreshold="731,351"
                <Controls:RadFluidContentControl.SmallContent> 
                    <TextBlock Text="Vehículo small"></TextBlock> 
                </Controls:RadFluidContentControl.SmallContent> 
                <Controls:RadFluidContentControl.Content> 
                    <TextBlock Text="Vehículo content"></TextBlock> 
                </Controls:RadFluidContentControl.Content> 
                <Controls:RadFluidContentControl.LargeContent> 
                    <TextBlock Text="Vehículo large"></TextBlock> 
                </Controls:RadFluidContentControl.LargeContent> 
            </Controls:RadFluidContentControl> 
        </NavigationControls:RadTileViewItem.Content> 
    </NavigationControls:RadTileViewItem> 
    <NavigationControls:RadTileViewItem> 
        <NavigationControls:RadTileViewItem.Header> 
            <TextBlock Text="Empresa header"></TextBlock> 
        </NavigationControls:RadTileViewItem.Header> 
        <NavigationControls:RadTileViewItem.Content> 
            <Controls:RadFluidContentControl AnimationControls:AnimationManager.IsAnimationEnabled="True" 
                                             SmallToNormalThreshold="291,130" 
                                             NormalToSmallThreshold="292,131" 
                                             NormalToLargeThreshold="735,350" 
                                             LargeToNormalThreshold="731,351"
                <Controls:RadFluidContentControl.SmallContent> 
                    <TextBlock Text="Empresa small"></TextBlock> 
                </Controls:RadFluidContentControl.SmallContent> 
                <Controls:RadFluidContentControl.Content> 
                    <TextBlock Text="Empresa content"></TextBlock> 
                </Controls:RadFluidContentControl.Content> 
                <Controls:RadFluidContentControl.LargeContent> 
                    <TextBlock Text="Empresa large"></TextBlock> 
                </Controls:RadFluidContentControl.LargeContent> 
            </Controls:RadFluidContentControl> 
        </NavigationControls:RadTileViewItem.Content> 
    </NavigationControls:RadTileViewItem> 
</NavigationControls:RadTileView> 

Could there be anything I'm missing? Thanks.
Tihomir Petkov
Telerik team
 answered on 11 Mar 2010
1 answer
108 views
I'm trying to get the underlying object that's bound to a dropped item in a drag-drop operation. In my case the underlying object is of type Model.Topic.

I use the following code:

private void RadTreeView_DragEnded(object sender, Telerik.Windows.Controls.RadTreeViewDragEndedEventArgs e)  
        {  
            object droppedTopics = e.DraggedItems;  
              
            object targetDropItem = e.TargetDropItem;  
            Model.Topic targetTopic = targetDropItem as Model.Topic;  
 
            foreach (object droppedTopic in e.DraggedItems as Collection<object>)  
            {  
                Model.Topic sourceTopic = droppedTopic as Model.Topic;  
                targetTopic.ParentTopicId = sourceTopic.ID;  
            }  
        }  
 

The problem is that after the following line, targetTopic is always null.

Model.Topic targetTopic = targetDropItem as Model.Topic; 

The question is, what is the correct way to get the underlying object that is bound to a dragged/dropped item?
Tina Stancheva
Telerik team
 answered on 10 Mar 2010
2 answers
826 views
<UserControl  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:s="clr-namespace:RttmVision.Presentation" 
    xmlns:p="clr-namespace:RttmVision.Presentation.Properties" 
    xmlns:c="clr-namespace:RttmVision.Presentation.Converters" 
    xmlns:widgets="clr-namespace:RttmVision.Applications.Widgets;assembly=RttmVision.Applications" 
    xmlns:services="clr-namespace:RttmVision.Applications.Services;assembly=RttmVision.Applications" 
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:telerikAnimation="clr-namespace:Telerik.Windows.Controls.Animation;assembly=Telerik.Windows.Controls" 
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
     xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" 
   xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls" 
    x:Class="RttmVision.Presentation.Views.BasicWidgetView" 
        
    MinHeight="300" MinWidth="300"  Loaded="ThisLoaded" 
       telerikDragDrop:RadDragAndDropManager.AllowDrag="True"           
          
    > 
 
    <UserControl.Resources> 
 
        <!-- ResizeDecorator Template --> 
        <ControlTemplate x:Key="ResizeDecoratorTemplate"  TargetType="{x:Type Control}">  
            <Grid > 
                <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0" 
                       VerticalAlignment="Top" HorizontalAlignment="Stretch"/>  
                <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0" 
                       VerticalAlignment="Stretch" HorizontalAlignment="Left"/>  
                <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0" 
                       VerticalAlignment="Stretch" HorizontalAlignment="Right"/>  
                <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4" 
                       VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>  
                <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-6 -6 0 0" 
                       VerticalAlignment="Top" HorizontalAlignment="Left"/>  
                <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -6 -6 0" 
                       VerticalAlignment="Top" HorizontalAlignment="Right"/>  
                <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-6 0 0 -6" 
                       VerticalAlignment="Bottom" HorizontalAlignment="Left"/>  
                <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -6 -6" 
                       VerticalAlignment="Bottom" HorizontalAlignment="Right"/>  
            </Grid> 
        </ControlTemplate> 
 
        <!-- Designer Item Template--> 
        <ControlTemplate x:Key="DesignerItemTemplate" TargetType="ContentControl">  
            <Grid Height="Auto" Width="Auto" 
                DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=.}">  
                <s:MoveThumb Template="{StaticResource MoveThumbTemplate}" Cursor="SizeAll"/>  
                <Control  Template="{StaticResource ResizeDecoratorTemplate}"/>  
                <ContentPresenter Content="{TemplateBinding Content}"    /> 
            </Grid> 
 
        </ControlTemplate> 
 
        <!--Popup--> 
        <!--We have a style because we are actually going to be using multiple thumbs for   
        resizing (one for the bottom edge, one for the corner, and one for the right edge),  
        and this way we don't have to repeat these property and event setters. --> 
        <Style TargetType="{x:Type Thumb}"   
          x:Key="PopupThumb">  
            <!--Setting the alignment properties to stretch just guarantees that the thumbs will fill their respective conta--> 
            <Setter Property="HorizontalAlignment"   
             Value="Stretch"/>  
            <Setter Property="VerticalAlignment"   
             Value="Stretch"/>  
            <EventSetter Event="Thumb.DragStarted"   
                  Handler="ThumbDragStarted" /> 
            <EventSetter Event="Thumb.DragDelta"   
                  Handler="ThumbDragDelta" /> 
            <EventSetter Event="Thumb.DragCompleted"   
                  Handler="ThumbDragCompleted" /> 
        </Style> 
 
        <!--Setup for Popup TreeView--> 
 
 
        <Style x:Key="Expander" TargetType="{x:Type ToggleButton}">  
            <Setter Property="IsEnabled" Value="True" /> 
            <Setter Property="IsTabStop" Value="False" /> 
            <Setter Property="Cursor" Value="Hand"/>  
            <Setter Property="Template">  
                <Setter.Value> 
                    <ControlTemplate TargetType="{x:Type ToggleButton}">  
                        <Grid x:Name="Button" Margin="0,4,0,0" HorizontalAlignment="Right" 
                              VerticalAlignment="Top" Width="16" Height="16">  
                            <Rectangle Stroke="#FF027BA6" HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch" Width="Auto" Height="Auto" 
                                  RadiusX="3" RadiusY="3" Fill="#FF00A2DC"/>  
                            <Rectangle x:Name="CollapsedVisual" HorizontalAlignment="Left" 
                                  VerticalAlignment="Top" Width="2" Height="8" RadiusX="0" 
                                  RadiusY="0" Fill="#FFFFFFFF" Margin="7,4,0,0" /> 
                            <Rectangle RadiusX="0" RadiusY="0" Fill="#FFFFFFFF" 
                                  HorizontalAlignment="Left" Margin="4,7,0,0" 
                                  VerticalAlignment="Top" Width="8" Height="2" /> 
                        </Grid> 
                    </ControlTemplate> 
                </Setter.Value> 
            </Setter> 
        </Style> 
 
 
 
        <!--Converter for CheckState--> 
        <s:CheckStateConverter x:Key="CheckStateConverter" /> 
        <c:CellbackGroundColorConverter  
                            x:Key="colorConverter" /> 
 
        <!--Bindings collection for the RadTreeViewItems--> 
        <Style x:Key="BindingsCollection"  TargetType="{x:Type telerikNavigation:RadTreeViewItem}" > 
            <Setter Property="CheckState" Value="{Binding Checked, Mode=TwoWay, Converter={StaticResource CheckStateConverter}}" /> 
            <Setter Property="IsSelected" Value="{Binding Selected, Mode=TwoWay}" /> 
            <Setter Property="IsExpanded" Value="{Binding Expanded, Mode=TwoWay}" /> 
        </Style> 
 
 
        <DataTemplate x:Key="MessageName">  
            <TextBlock Text="{Binding MessageName}" ToolTip="Message Name" Foreground="Black" FontSize="10"></TextBlock> 
        </DataTemplate> 
 
        <HierarchicalDataTemplate   
            x:Key="PacketInfo"   
            ItemTemplate="{StaticResource MessageName}"   
            ItemsSource="{Binding Messages}">  
            <TextBlock Text="{Binding PacketName}" ToolTip="Packet Name" Foreground="Blue" FontSize="10"/>             
        </HierarchicalDataTemplate> 
 
 
 
        <!--End of setup for Popup TreeView--> 
 
 
    </UserControl.Resources> 
 
 
 
    <UserControl.ContextMenu> 
        <ContextMenu> 
            <MenuItem  Click="MenuItem_Click" Header="{x:Static p:Resources.ViewPackets}" Icon="" InputGestureText="{x:Static p:Resources.ControlR}" /> 
        </ContextMenu> 
    </UserControl.ContextMenu> 
 
    <ContentControl Width="200" 
                      Height="100" 
                      Padding="2" 
                      Canvas.Left="360" 
                      Canvas.Top="60" 
                      Template="{StaticResource DesignerItemTemplate}" 
                    > 
        <Grid   
            Width="Auto"   
            Height="Auto" > 
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="13*" /> 
                <ColumnDefinition Width="187*" /> 
            </Grid.ColumnDefinitions> 
            <Border CornerRadius="5" 
                  IsHitTestVisible="False" 
                  BorderBrush="#E0E0E0" 
                  BorderThickness="0,1,0,0" 
                  Background="{DynamicResource FrameBackground}" Grid.ColumnSpan="2" /> 
            <Border BorderBrush="Black" 
                  BorderThickness="0,0,0,1" 
                  CornerRadius="5" Grid.ColumnSpan="2" /> 
            <Border Background="WhiteSmoke" CornerRadius="5" Margin="5,5,5,25" IsHitTestVisible="False" Grid.ColumnSpan="2" /> 
            <Border BorderBrush="White" BorderThickness="0,0,1,1" CornerRadius="5" Margin="5,5,5,25" Grid.ColumnSpan="2" /> 
            <Border BorderBrush="Black" BorderThickness="1,1,0,0" CornerRadius="5" Margin="5,5,5,25" Grid.ColumnSpan="2">  
 
                <telerikGrid:RadGridView x:Name="PacketRadGridView" 
                    EnableColumnVirtualization="True"   
                    EnableRowVirtualization="True" 
                    AutoGenerateColumns="False"   
                      CanUserFreezeColumns="False"   
                     ItemsSource="{Binding ReceivedPackets}"   
                    IsReadOnly="True" 
                    DataLoadMode="Asynchronous"   
                                           
                    > 
 
                    <telerikGrid:RadGridView.Resources> 
 
 
                        <Style x:Key="CustomColorCellStyle" TargetType="{x:Type telerik:GridViewCell}">  
                            <Setter Property="Background" Value="{Binding Converter={StaticResource colorConverter}}">  
                            </Setter> 
                        </Style> 
 
                    </telerikGrid:RadGridView.Resources> 
 
                    <telerik:RadGridView.ChildTableDefinitions> 
                        <telerik:GridViewTableDefinition> 
                        </telerik:GridViewTableDefinition> 
                    </telerik:RadGridView.ChildTableDefinitions> 
                    <telerik:RadGridView.Columns> 
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding PacketName}" Header="Packet" /> 
 
                    </telerik:RadGridView.Columns> 
 
                    <telerik:RadGridView.HierarchyChildTemplate> 
                        <DataTemplate> 
                            <telerik:RadGridView   
                                x:Name="RadGridView1"   
                                CanUserFreezeColumns="False"   
                                AutoGenerateColumns="False"   
                                  
                                ItemsSource="{Binding Messages}"   
                                ShowGroupPanel="False"   
                                IsReadOnly="True" 
                                Loaded="RadGridView1_Loaded">  
                                <telerik:RadGridView.Columns> 
                                    <telerik:GridViewDataColumn UniqueName="Variable" DataMemberBinding="{Binding MessageName}" Header="Variable" /> 
                                    <telerik:GridViewDataColumn UniqueName="Value" CellStyle="{StaticResource CustomColorCellStyle}" DataMemberBinding="{Binding Value}" Header="Value"/>  
                                </telerik:RadGridView.Columns> 
                            </telerik:RadGridView> 
                        </DataTemplate> 
                    </telerik:RadGridView.HierarchyChildTemplate> 
 
 
                </telerikGrid:RadGridView> 
 
 
 
            </Border> 
 
            <Popup x:Name="packetPopup" StaysOpen="False" Width="300" Height="300"   
             Placement="Mouse" Closed="packetPopup_Closed">  
                <Border BorderBrush="#FF3F509D" BorderThickness="5,5,3,3">  
                    <Grid Background="White">  
                        <Grid.RowDefinitions> 
                            <RowDefinition Height="*" /> 
                            <RowDefinition Height="10" /> 
                        </Grid.RowDefinitions> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="*" /> 
                            <ColumnDefinition Width="10" /> 
                        </Grid.ColumnDefinitions> 
 
                        <telerikNavigation:RadTreeView   
                            SelectionMode="Extended"   
                            IsLineEnabled="True"   
                            ItemsOptionListType="CheckList"   
                            IsOptionElementsEnabled="True"   
                            IsRootLinesEnabled="True"   
                            IsTriStateMode="True" 
                              
                            ItemsSource="{Binding PacketDefinitions}"   
                            ItemTemplate="{StaticResource PacketInfo}"   
                            ExpanderStyle="{StaticResource Expander}"   
                            Checked="RadTreeView_Checked"   
                            Unchecked="RadTreeView_Checked"   
                            telerikAnimation:AnimationManager.IsAnimationEnabled="False"   
                            ScrollViewer.HorizontalScrollBarVisibility="Auto"   
                            ScrollViewer.VerticalScrollBarVisibility="Auto"   
                            ItemContainerStyle="{StaticResource BindingsCollection}"/>  
 
 
                        <Thumb Grid.Row="0" Grid.Column="1"   
                Cursor="SizeWE" 
                Style="{StaticResource PopupThumb}"/>  
                        <Thumb Grid.Row="1" Grid.Column="0"   
                Cursor="SizeNS" 
              Style="{StaticResource PopupThumb}"/>  
                        <Thumb Grid.Row="1" Grid.Column="1"   
                Cursor="SizeNWSE" 
              Style="{StaticResource PopupThumb}"/>  
                    </Grid> 
                </Border> 
            </Popup> 
 
 
        </Grid> 
          
    </ContentControl> 
 
</UserControl> 
 
I have the above user control it is bound to an Items Control which has an ItemsPanelTemplate of type Canvas.  I am able to drag and drop the user control around the canvas but when I try resize the user control using the resize thumb, the user control goes into drag mode.  I have tried moving the  telerikDragDrop:RadDragAndDropManager.AllowDrag="True"  to inner controls but then the User Control will not drag on the Canvas.  How can I have a drag-able User Control that is also re-sizable?
Here is the code for the the Items control:
<Grid> 
        <ItemsControl x:Name="WidgetItemsControl"  ItemsSource="{Binding WidgetViews}"  Margin="5" > 
                 
                <ItemsControl.ItemsPanel> 
                      
                    <ItemsPanelTemplate> 
                        <Canvas  x:Name="WidgetCanvas" Background="#303030" Width="Auto" Height="Auto" ClipToBounds="True" telerikDragDrop:RadDragAndDropManager.AllowDrop="True"  > 
                            <Canvas.ContextMenu> 
                                <ContextMenu Name="WidgetContextMenu">  
                                    <MenuItem Command="{Binding NewWidgetCommand}" Header="{x:Static p:Resources.NewWidget}" Icon="{StaticResource NewImage}" InputGestureText="{x:Static p:Resources.ControlW}" /> 
                                </ContextMenu> 
                            </Canvas.ContextMenu> 
 
                </Canvas> 
                    </ItemsPanelTemplate> 
                  
                </ItemsControl.ItemsPanel> 
 
        <ItemsControl.ItemContainerStyle> 
            <Style> 
                <Setter Property="Canvas.Left" Value="{Binding Left}" /> 
                <Setter Property="Canvas.Top" Value="{Binding Top}" /> 
            </Style> 
        </ItemsControl.ItemContainerStyle> 
 
 
    </ItemsControl> 
         
    </Grid> 

Thanks for your help!

Steve Burns
Steve
Top achievements
Rank 1
 answered on 10 Mar 2010
3 answers
129 views

Hello....

I am currently working with a grouped RadGridView in which I must add three Sum AggregateFunctions.

The code that I use to do this is the following

radGridInvoiceDetails.ItemsSource = null;
if (CurrentMaster != null)
{
    var collection = from d in dc.InvoiceDetails
                     where d.IdInvoiceMaster == CurrentMaster.Id
                     orderby d.IdProductType, d.ProductDescription, d.BillNumber
                     select d;
                    
    radGridInvoiceDetails.ItemsSource = collection.ToList();
}

GroupDescriptor descriptor = new Telerik.Windows.Data.GroupDescriptor();

descriptor.Member = "ProductFamilyDescription";
descriptor.SortDirection = ListSortDirection.Ascending;
radGridInvoiceDetails.GroupDescriptors.Add(descriptor);

descriptor = new Telerik.Windows.Data.GroupDescriptor();
descriptor.Member = "ProductDescription";
descriptor.SortDirection = ListSortDirection.Ascending;

var sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "ProductQuantity";
sumFunction.Caption = "Totale Quantità";
descriptor.AggregateFunctions.Add(sumFunction);

sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "TotalBill";
sumFunction.Caption = "Totale Imponibile";
descriptor.AggregateFunctions.Add(sumFunction);

sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "TotalVAT";
sumFunction.Caption = "Totale Con IVA";

descriptor.AggregateFunctions.Add(sumFunction);

radGridInvoiceDetails.GroupDescriptors.Add(descriptor);

The result of this is wonderful but it takes up to 90 seconds to load less than 1500 records.

I have read something about QueryableCollectionView but I did not find enough to understand if and how it can help me.

Is there any suggestion to spend less time to have the same result??

Thanks a lot in advance...

Nick

Vlad
Telerik team
 answered on 10 Mar 2010
10 answers
140 views
Hi,
I have a simple app very similar to the carousel demo (First look), the app was working fine with 2009 Q2, but  after upgrade to 2009 Q3, the app throws the following error:

System.Reflection.TargetInvocationException was unhandled
  Message="Exception has been thrown by the target of an invocation."
  Source="mscorlib"
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       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.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(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.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       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.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at CuiraWPF.App.Main() in D:\projects2\own\XMPP messenger\client\Cuira\CuiraWPF\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.InvalidOperationException
       Message="Added item does not appear at given index '3'."
       Source="PresentationFramework"
       StackTrace:
            at System.Windows.Data.ListCollectionView.AdjustBefore(NotifyCollectionChangedAction action, Object item, Int32 index)
            at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
            at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 506
            at Telerik.Windows.Data.DataItemCollection.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 725
            at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 32
            at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
            at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 482
            at Telerik.Windows.Data.QueryableCollectionView.RefreshAndRaiseCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 557
            at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 640
            at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 631
            at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 32
            at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
            at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
            at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index)
            at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
            at System.Collections.ObjectModel.Collection`1.Add(T item)
            at CuiraWPF.Code.MessengerHelper.<>c__DisplayClass17.<Connection_OnRosterItem>b__13() in D:\projects2\own\XMPP messenger\client\Cuira\CuiraWPF\Code\MessengerHelper.cs:line 305
       InnerException: 

The code line 305 is just a : ContactList.Add(current);

Any clues?

Additional information:
I found a temp fix:
I have an event handler that is listening when the collection changes, every time the observable collection is changed, it is reordered, I created a class that inherits from ObservableCollection, I have used that class on Silverlight with your components and it works fine, as I mentioned, the code works fine with Q2 and WPF, my temp solution was to comment the sort code and its working now, not the way that I need, but at least is displaying data.

Pedro
Top achievements
Rank 1
 answered on 10 Mar 2010
1 answer
70 views
Hello:

 In a chart of HorizontalBarSeriesDefinition, the SeriesItemLabel are over bar of right to left.  I need this label of left to right ( label must be out of the bar). I used the style  over SeriesItemLabel with margin = {20,0,0,0}. However, the value is dynamic and continuously over the bar


 have you some solution?
Dwight
Telerik team
 answered on 10 Mar 2010
2 answers
293 views
<Window x:Class="WpfApplication6.MainWindow" 
        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="MainWindow" Height="350" Width="525"
        <DockPanel> 
            <telerik:RadButton Content="{Binding ElementName=_slider, Path=Value}" ContentStringFormat="{}{0:p0}" VerticalAlignment="Center" HorizontalContentAlignment="Center" MinWidth="50" BorderBrush="Transparent" BorderThickness="0" Background="Transparent"/> 
            <telerik:RadSlider x:Name="_slider" HandlesVisibility="Visible" VerticalAlignment="Center" Minimum="0.1" EnableSideTicks="True" TickFrequency="0.1" IsSnapToTickEnabled="True" Maximum="4" Value="1"/> 
        </DockPanel> 
</Window> 
Making the RadButton a WPF Button produces the proper "100%" string (en-US culture).  The RadButton produces "1"
This seems to me to be a bug.
Ivan
Telerik team
 answered on 10 Mar 2010
1 answer
172 views
I have the following scenario

I have an ItemsCollection in which the ItemsSource is bound to an observablecollection of DataTables. These datatables are dynamically generated at runtime.

When the grid is loaded I want to loop through each of the cells and set a tooltip and background color of the cell based on some condition.

How can I do this?

Thanks,

Billy Jacobs
StevenDale
Top achievements
Rank 2
 answered on 09 Mar 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?