Telerik Forums
UI for WPF Forum
2 answers
258 views
I am using AggregateFunctions in GridView, but the function will not recalculate automatically when the data update.
I  tried to manually call CalculateAggregates(), but still not working.
I spent a lot of time to search for that, and found that a lot of people have similar problems. But I did't find a good solution.

The only way I know is to use Rebind() after the data updates. I think there should be some better ways.


I created a sample project here. If click the button, it will increase the number by one. If I group it by Position, and click the button, the number data value changes, but the  sum value does not.
Could someone help me with it please?

Thanks very much.



<Window x:Class="SampleProject.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"
        xmlns:my="clr-namespace:SampleProject"
        Title="MainWindow" Height="700" Width="700">
 <Window.Resources>
  <my:MyViewModel x:Key="myViewModel"/>
 </Window.Resources>
    <Grid DataContext="{StaticResource myViewModel}">
  <Grid.RowDefinitions>
   <RowDefinition Height="*"/>
        
   <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>
        <telerik:RadGridView Name="playersGrid" Grid.Row="0"
                                     ItemsSource="{Binding Players}"
                                     AutoGenerateColumns="False">  
   <telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}">
     <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction SourceField="Number"  Caption="Column count: " />
     </telerik:GridViewDataColumn.AggregateFunctions>
    </telerik:GridViewDataColumn>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
   </telerik:RadGridView.Columns>
  </telerik:RadGridView>
    
        <StackPanel Grid.Row="1" Orientation="Horizontal">
   <telerik:RadButton Name="Button1"
                Content="Update Data"
                Click="Button_Click"
                Margin="5"
                HorizontalAlignment="Left"/>
        
  </StackPanel>
 </Grid>
</Window>









kingnight
Top achievements
Rank 1
 answered on 09 Jan 2013
1 answer
117 views
Hi,
I have a grid view and I wonder is it possible to create a template for the first row in the grid?
Or can I specify item template for the first row only? What is the best workaround for this problem?

Thank you,
Ihor.
Yoan
Telerik team
 answered on 08 Jan 2013
3 answers
129 views
Hi,

I am using the Telerik DataFilter and was trying to compare values of two columns.

Basically I wanted to:

[Column1]    is less than [Column2]  - This filter should go through all the row and get only those rows where value of column1 is less than column2, provided here column1 and column2 are of same type(may be int)

I am getting list of columns by binding DataFilter to a collection. But I was wondering if it is possible to compare the rows in the column.

If it is possible, can you please point me to some example where this has already been implemented.

Thanks
Harpreet
Dimitrina
Telerik team
 answered on 08 Jan 2013
3 answers
160 views
Hi, i want to achieve some thing like "Pivot chart in Excel". i need to design custom x axis as shown in image. can you please give me any idea how to achieve it in RadChart.
Petar Marchev
Telerik team
 answered on 08 Jan 2013
3 answers
166 views
Hello,

I am using the WPF RadRichTextBox to enter text and images.

I am using the RtfFormatProvider to serialize/deserialize the contents of the RadDocument and save the document into the database. I do this by using the .Import and .Export methods. Additionally I am using GZipStream to compress/decompress.

I have tried just using the RtfFormatProvider without GZip to ensure it wasn't the compression/decompression causing a problem, but that did not make a difference.

The issue I am running into, is when I deserialize the RadDocument from the RtfFormatProvider and set the .Document of the RichTextBox, and then try to view the user control containing the RadRichTextBox, I get the following error, which locks up the UI:

------

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Documents.Model.ImageDocumentElementHelper.SetupImage(Image image, IImageDocumentElement imageElement) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Model\ImageDocumentElementHelper.cs:line 107
   at Telerik.Windows.Documents.UI.UIProviders.ImageUIProvider.UpdateUI(UILayerUpdateContext uILayerUpdateContext) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\UIProviders\ImageUIProvider.cs:line 115
   at Telerik.Windows.Documents.UI.Layers.ProviderUILayerBase.UpdateUI() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\Layers\ProviderUILayerBase.cs:line 123
   at Telerik.Windows.Documents.UI.Layers.ProviderUILayerBase.UpdateViewPort(UILayerUpdateContext context) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\Layers\ProviderUILayerBase.cs:line 110
   at Telerik.Windows.Documents.UI.DocumentPagePresenter.UpdateUILayersViewPortSize(RectangleF viewPort) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPagePresenter.cs:line 838
   at Telerik.Windows.Documents.UI.DocumentPagePresenter.MeasureOverride(Size availableSize) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPagePresenter.cs:line 752
   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.ContentPresenter.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 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 Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.MeasureOverride(Size availableSize) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPrintLayoutPresenter.cs:line 686
   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.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.Border.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.Grid.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, Boolean& hasDesiredSizeUChanged)
   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.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.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.Control.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 System.Windows.Controls.Border.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 System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.Border.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 System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.Border.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.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.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.Controls.DockPanel.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.Controls.Border.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, Boolean& hasDesiredSizeUChanged)
   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.Border.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 System.Windows.Controls.DockPanel.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.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.Controls.DockPanel.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, Boolean& hasDesiredSizeUChanged)
   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.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   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.DockPanel.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.Controls.DockPanel.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, Boolean& hasDesiredSizeUChanged)
   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.Documents.AdornerDecorator.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.Window.MeasureOverrideHelper(Size constraint)
   at System.Windows.Window.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   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 System.Windows.Window.SetRootVisual()
   at System.Windows.Window.SetRootVisualAndUpdateSTC()
   at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
   at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   at System.Windows.Window.CreateSourceWindowDuringShow()
   at System.Windows.Window.SafeCreateWindowDuringShow()
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
 
 
------

The above error occurs when attempt to view the text box, it doesn't throw this error when I set the .Document.

I can successfully re-load content into the control if there is just text, but when I try to re-load a document that contains images it throws this error.

I have copied images into my document both straight from paint and from MS Office, and this did not make any difference either.

I would appreciate any suggestions or help anyone can offer.

Thank you.
Michael
Top achievements
Rank 1
 answered on 07 Jan 2013
1 answer
304 views

Hello Team,

I've got a Listbox and a GridLayout. The GridLayout is hosted by an ItemsControl and styled by a DataTemplate. This works fine.
Now the user should be able to drag an item from the listbox into the GridLayout. This works too, but only if the payload is being dropped on the TextBlock. Otherwise the DragStatus is always DropImpossible. It should be possible to drop the payload anywhere into the grid cell.

I have studied the examples but I can't get it to work.
Could please have a look at my code?


<Page.Resources>
    <DataTemplate DataType="{x:Type local:ViewModelRasterElement}">
        <Border BorderBrush="#EFEFEF" BorderThickness="1"
                telerikDragDrop:RadDragAndDropManager.AllowDrop="True"
                telerikDragDrop:RadDragAndDropManager.AllowDrag="True">
             
                <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"
                           Text="{Binding Bezeichnung}"/>
        </Border>
    </DataTemplate>
 
    <DataTemplate x:Key="ApplicationDragTemplateTextbox">
        <TextBox Width="200" Height="20"/>
    </DataTemplate>
    <DataTemplate x:Key="ApplicationDragTemplateLabel">
        <Label Background="Yellow" Content="Ziehen Sie den in eine bliebige Zelle"/>
    </DataTemplate>
</Page.Resources>


<ItemsControl ItemsSource="{Binding RasterElemente}">
    <ItemsControl.ItemContainerStyle>
        <Style>
            <Setter Property="Grid.Row" Value="{Binding GridRow}" />
            <Setter Property="Grid.Column" Value="{Binding GridColumn}" />
        </Style>
    </ItemsControl.ItemContainerStyle>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <Grid ShowGridLines="false"
                  telerikDragDrop:RadDragAndDropManager.AllowDrop="True"
                  telerikDragDrop:RadDragAndDropManager.AllowDrag="True">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                    <ColumnDefinition Width="130"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>

And here the code behind:

public ViewTest()
{
    InitializeComponent();
 
    RadDragAndDropManager.AddDragQueryHandler(this, OnDragQuery);
    RadDragAndDropManager.AddDropQueryHandler(this, OnDropQuery);
    RadDragAndDropManager.AddDropInfoHandler(this, OnDropInfo);
}
 
private void OnDropInfo(object sender, DragDropEventArgs e)
{
    Console.WriteLine(e.Options.Status);
    if (e.Options.Status == DragStatus.DropComplete)
    {
        string typ = e.Options.Source.GetType().ToString();
        switch (typ)
        {
            case "System.Windows.Controls.ListBox":
                {
                    if (e.Options.Payload != null)
                    {
                        ViewModelRasterElement element = (ViewModelRasterElement)e.Options.Destination.DataContext;
                        element.Bezeichnung = e.Options.Payload.ToString();
                    }
                }
                break;
            default:
                break;
        }
    }
    e.Handled = true;
}
 
void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
    Console.WriteLine(e.Options.Status);
    Console.WriteLine(e.Options.Destination.DataContext.GetType().ToString());
     
    if (e.Options.Destination.DataContext is ViewModelRasterElement &&
        e.Options.Status == DragStatus.DropDestinationQuery)
    {
        e.QueryResult = true;
    }
    e.Handled = true;
    Console.WriteLine(e.QueryResult);
}
 
protected virtual void OnDragQuery(object sender, DragDropQueryEventArgs e)
{
    string typ = e.Options.Source.GetType().ToString();
    switch (typ)
    {
        case "System.Windows.Controls.ListBox":
            {
                ListBox listbox = (ListBox)e.Options.Source;
                if (listbox.SelectedItem != null)
                {
                    if (e.Options.Status == DragStatus.DragQuery)
                    {
                        e.Options.Payload = listbox.SelectedItem;
                        ContentControl cue = new ContentControl();
                        cue.ContentTemplate = this.Resources["ApplicationDragTemplateLabel"] as DataTemplate;
                        cue.Content = listbox.SelectedItem;
                        e.Options.DragCue = cue;
                        e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
                    }
                }
            }
 
            break;
        default:
            break;
    }
 
    e.Handled = true;
    e.QueryResult = true;
}


Thank you for your assistance.

Best regards

Josef
Arthur
Top achievements
Rank 1
 answered on 07 Jan 2013
14 answers
254 views

Hi Petar,  as we have discussed previously, my app receives data from remote sources and I add it to a chart in the elapsed event of a timer.  The timer that updates the chart runs continuously however there are often periods of time when no data is received.  For those periods I want to display the X axis label (i.e. the time) and a blank space where the bar should be.  So, for long periods of time where no data is received the user should simply see the x axis labels scrolling to the left (no bars) as the chart is updated.  Please note in my app that there are no series initially defined for my chart.  The reason for that is that the series are linked to a property of the data and until I have data to display I don’t know what series to display.

Having said that, there are two  issues which I would like to bring to your attention and attempt to resolve:
1.)  When the application is first loaded there is no data and no series as described above.  I add a series with Y values = 0 and X values containing time periods in the past (the labels on the X axis are time stamps).  The purpose of adding this series is to  overcome issues with bar width that I have asked about in prior posts, and also to act as a placeholder for time periods (bars) where there is no data.  My intent is that the X axis labels should ALWAYS appear on the chart, but the bar fragments for this placeholder series should never appear on the chart (the Y values are always zero).  The problem is that when there is no data there is no Y axis so the placeholder series is plotted at the full height of the chart even though the values are zero.  How do I suppress plotting the bars for this series but keep the X axis labels?  Ideally I would like a Y axis scale to always appear on the chart.  If I could initially set that scale to have a max of, say, 1 that would cause the zero value placeholder series to have no height which would work just fine.

2.) When all data scrolls off the left side of the chart, new bars are not plotted when data is received.  This issue can be reproduced as follows:

Load the attached app and click Start Generating Data.

Wait until a few bars are generated then click Stop Generating Data.
Wait until all bars have scrolled off the left side of the chart. Notice that the placeholder series is plotted at full height (this is the issue described above).
Click Start Generating Data.  Notice that no bars are plotted.

Repeat the above steps but do not allow all data to scroll off the left side of the chart.  When you click Start Generating Data again, data will plot as expected.

I found that adding a placeholder row in my data collection will work around this issue.  Uncomment the following code in the AddLoadStatistic method.  However I am not certain this is a fix, or perhaps I am doing something else that’s wrong that is causing this issue (???).

if (LoadSources.Count > 0)
            {
                foreach (System.Collections.DictionaryEntry key in LoadSources)
                    LoadStatistics.Add(new LoadStatistic { PeriodEnding = LoadIntervalEndTime, Source = key.Key.ToString() });
            }
            else

Sam
Top achievements
Rank 1
 answered on 07 Jan 2013
6 answers
222 views
Hi

I would like to avoid deselecting currently selected shape while clicking on the diagram.
When you click on the diagram, out of a shape, the currently selected shape is deselected.
I couldn't find a way to configure or do that.
Thanks for your help.

Cheers
Laurent Kempé
Laurent Kempé
Top achievements
Rank 2
 answered on 07 Jan 2013
3 answers
339 views
I have created a RadPanelBar with two items. I want the DefaultItem to be selected by default. How can I do that dynamically?
Below is the xaml code for RadPanelBar

<
telerik:RadPanelBar x:Name="mybar" Width="252" Height="500" HorizontalAlignment="Left"  VerticalAlignment="Top" ExpandMode="Single" Margin="0,58,0,0" SelectedItem="{Binding PanelBarItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                <telerik:RadPanelBarItem x:Name="DefaultItem" >
                    <telerik:RadPanelBarItem.Header>
                        <TextBlock Text="Default Item" />
                    </telerik:RadPanelBarItem.Header>
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem x:Name="ExpandItem" >
                    <telerik:RadPanelBarItem.Header>
                        <TextBlock Text="Expand Item" />
                    </telerik:RadPanelBarItem.Header>
 
                    <ListBox Height="200" Margin="1,17,1,143" ItemsSource="{Binding TList}" BorderBrush="Transparent" BorderThickness="0"  SelectedItem="{Binding SelectedTool, Mode=TwoWay}"
                             >
                    </ListBox>
                </telerik:RadPanelBarItem>
 
            </telerik:RadPanelBar>

I also want the first item in the TList to be selected by default when ExpandItem is selected. Please help with this. 
Thanks in Advance 
Tina Stancheva
Telerik team
 answered on 07 Jan 2013
4 answers
111 views
Hello,
Is there a way to allow user input into AutoCompleteBox (text that is not in the list)?
Jasna
Top achievements
Rank 1
 answered on 07 Jan 2013
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?