I have a windows service that periodically sends emails with images of ChartView controls. I am having a hard time getting the ChartView to fully render unless I attach it to a window and show the window and then immediately close it. The code is running from a windows service and so this is really not desired.
If I render the control using the following BuildContentStream method then it simply displays the "No data to display message"
private
MemoryStream BuildContentStream(FrameworkElement visualItem,
int
width,
int
height)
{
var view = visualItem;
view.Measure(
new
Size(width, height));
view.Arrange(
new
Rect(0, 0, width, height));
view.UpdateLayout();
var rtb =
new
RenderTargetBitmap(width, height, 96, 96, PixelFormats.Default);
rtb.Render(view);
var png =
new
PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(rtb));
var memStream =
new
MemoryStream();
png.Save(memStream);
memStream.Position = 0;
return
memStream;
}
If I attach the control to a window and then do the following then it works correctly.
// The window acts as a visualizer. Can't get it working otherwise
var window =
new
RadWindow();
window.Height = 300;
window.Width = 400;
window.Content = errorItem.View;
window.WindowState = WindowState.Normal;
window.Show();
window.Close();
var stream = BuildContentStream(errorItem.View, 400, 300);
I have also tried the ExportToImage extension without success?
Is it possible to get this working from a windows service without any UI?
Hi,
Issue#1
We are using Rad Map control in one of our application where we need to show current position of the device. To achieve the functionality we are using timer to get updated position at regular interval.We are also using VirtualizationSource class to bind data on map (reference - http://demos.telerik.com/silverlight/#Map/DynamicLayer). But each time when we are binding the data to map control labels showing on the map are blinking. [see img1 & img2 Attached]
So Please suggest some solution for the same.
Issue#2
In above mentioned application, I want to retain the focus area of the Map. How can I achieve the same ?
Please guide.
Also, Is it possible to set Width and Height as AUTO of the Labels on the Map.
We are using telerik GridViews, and on the startup of the application we get the following exception thrown. We do not get any stack trace related to our application, so we don't know where to start looking for the source of the problem. It seems that when initializing the grid is some issue, but we don't know what could cause this.
[Message]:
Exception has been thrown by the target of an invocation.
[Type]:
System.Reflection.TargetInvocationException
[Target]:
System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
[Source]:
mscorlib
[StackTrace]:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.RoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at Telerik.Windows.Controls.GridView.GridViewHeaderRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn column, Boolean createIfNull)
at Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32 startIndex, Int32 predictedLastIndex, Func`2 calculateNextIndex)
at Telerik.Windows.Controls.GridView.GridViewCellsPanel.UpdateVirtualizedCells()
at Telerik.Windows.Controls.GridView.GridViewCellsPanel.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.ItemsPresenter.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 System.Windows.Controls.Control.MeasureOverride(Size constraint)
at Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size availableSize)
at Telerik.Windows.Controls.GridView.GridViewHeaderRow.MeasureOverride(Size availableSize)
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.ScrollViewer.MeasureOverride(Size constraint)
at Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(Size availableSize)
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 Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size availableSize)
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 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.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 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.WrapPanel.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.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, 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.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.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.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.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.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 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.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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)
[Message]:
Collection was modified; enumeration operation may not execute.
[Type]:
System.InvalidOperationException
[Target]:
Boolean MoveNextRare()
[Source]:
mscorlib
[StackTrace]:
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Telerik.Windows.DragDrop.DragDropManager.OnAllowDragPropertyChanged(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 Telerik.Windows.DragDrop.DragDropManager.SetAllowDrag(DependencyObject obj, Boolean value)
at Telerik.Windows.Controls.GridView.DragDropController.InitializeHeaderCellDragDrop(GridViewHeaderCell cell)
​
I create a VirtualQueryableCollectionView using the following method, the SourceCollection of the view is empty. Is there any way to force an initial load?
public
VirtualQueryableCollectionView GetVirtualQueryableCollectionView(
int
loadsize,
List<String> includes, Func<T,
bool
> whereClause,
Func<T, Object> orderBy,
bool
orderByIsDesc =
false
,
Func<T, Object> thenBy =
null
,
bool
thenByIsDesc =
false
)
{
ObjectQuery<T> q = Query(CreateContext());
if
(includes !=
null
)
{
foreach
(var include
in
includes)
{
q = q.Include(include);
}
}
if
(whereClause !=
null
)
{
if
(orderBy !=
null
)
{
if
(orderByIsDesc)
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.Where(whereClause).OrderByDescending(orderBy).ThenByDescending(thenBy);
}
else
{
q.Where(whereClause).OrderByDescending(orderBy).ThenBy(thenBy);
}
}
else
{
q.Where(whereClause).OrderByDescending(orderBy);
}
}
else
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.Where(whereClause).OrderBy(orderBy).ThenByDescending(thenBy);
}
else
{
q.Where(whereClause).OrderBy(orderBy).ThenBy(thenBy);
}
}
else
{
q.Where(whereClause).OrderBy(orderBy);
}
}
}
else
{
q.Where(whereClause);
}
}
else
if
(orderBy !=
null
)
{
if
(orderByIsDesc)
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.OrderByDescending(orderBy).ThenByDescending(thenBy);
}
else
{
q.OrderByDescending(orderBy).ThenBy(thenBy);
}
}
else
{
q.OrderByDescending(orderBy);
}
}
else
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.OrderBy(orderBy).ThenByDescending(thenBy);
}
else
{
q.OrderBy(orderBy).ThenBy(thenBy);
}
}
else
{
q.OrderBy(orderBy);
}
}
}
var view =
new
VirtualQueryableCollectionView(q)
{
LoadSize = loadsize
};
return
view;
}
​
How i can change style of collapse button in containerShape and it s possible to set backround color just for header in container?
Thank you
Hi,
We have had a request from a user who asked if we can show the Y-Axis on both sides of a chart. Is there an easy way to do this using your charts for WPF? The only approach to achieving this that I can see is to have two of each series but assign them to different axes. I would prefer not to do it this way if we can avoid it.
Thanks,
Steven
Dear All,
together with the address the Longitude & Latitude should be saved.
I tried to use the AutoResetEvent but it is not working.
After WaitOne() is called, nothing happens. The EventHanlder is never called.
Please let me know if you have an idea.
AutoResetEvent waitHandle = new AutoResetEvent(false);
if (fullAddress != String.Empty && Item.Longitude == 0 && Item.Latitude == 0)
{
Telerik.Windows.Controls.Map.BingSearchProvider provider = new Telerik.Windows.Controls.Map.BingSearchProvider(bingApplicationId);
Telerik.Windows.Controls.Map.SearchRequest newSearchRequest = new Telerik.Windows.Controls.Map.SearchRequest();
newSearchRequest.Query = fullAddress;
EventHandler<Telerik.Windows.Controls.Map.SearchCompletedEventArgs> eventHandler = delegate(object sender, Telerik.Windows.Controls.Map.SearchCompletedEventArgs e)
{
foreach (Telerik.Windows.Controls.Map.SearchResultSet result in e.Response.ResultSets)
{
if (result.SearchRegion != null)
{
Item.Longitude = Convert.ToDecimal(result.SearchRegion.GeocodeLocation.BestView.Center.Longitude);
Item.Latitude = Convert.ToDecimal(result.SearchRegion.GeocodeLocation.BestView.Center.Latitude);
Debug.WriteLine(String.Format("{0} Latitude:{1} Longitude:{2}", Item.Name1, Item.Latitude, Item.Longitude));
}
}
waitHandle.Set();
};
provider.SearchCompleted += eventHandler;
provider.SearchAsync(newSearchRequest);
waitHandle.WaitOne();
Debug.WriteLine(fullAddress);
}
Hi!
I want to display a scale bar (see attached image) in the chart. How can I achieve this?
I don't see an annotation type where I can specify the position in absolute values, but the size in units of the MajorStep.
I need it in both Cartesian and Polar charts.
A second question: How can I display a label for a PolarAxisGridLineAnnotation?
Alex
Dear Team,
We are facing the below issue while trying to bind a Combobox inside a Gridview.
Binding of data is not happening to Dropdown inside the grid view and we sae the below error messages in Visual studio output.
I have attached the Error message and the code snippets in the document.
Could you please let us know your feedback on the same and this is a bit critical for us to resolve. Thanks