Hi There
I'm calling WPF RadMap usercontrol inside Window form usercontrol using elementHost. But while calling using UI Virtualization it gives error as shown below.The below code works fine in standalone WPF usercontrol.
The below code works.
Later I found that this is threading issue related to STA architecture, as it also throw the error "The calling thread must be STA,because many UI components require this". See the attachment.
Cheers.
I'm calling WPF RadMap usercontrol inside Window form usercontrol using elementHost. But while calling using UI Virtualization it gives error as shown below.The below code works fine in standalone WPF usercontrol.
MapShapeDataVirtualizationSource map = new MapShapeDataVirtualizationSource(); AsyncShapeFileReader reader = new AsyncShapeFileReader(); reader.ToolTipFormat = "FieldName"; reader.Source = new Uri(rShape["path"].ToString() + ".shp", UriKind.RelativeOrAbsolute); reader.DataSource = new Uri(rShape["path"].ToString() + ".dbf", UriKind.RelativeOrAbsolute); map.Reader = reader; map.ReadAsync(); // Give the error .See the attached Error screen shot. map.ClearCache = false; vLayer.VirtualizationSource = map; vLayer.UseBitmapCache = false; vLayer.RefreshVirtualSource(); this.radMapNaveo.Items.Add(vLayer);The below code works.
AsyncShapeFileReader reader = new AsyncShapeFileReader(); reader.ToolTipFormat = "FieldName"; reader.Source = new Uri(rShape["path"].ToString() + ".shp", UriKind.RelativeOrAbsolute); reader.DataSource = new Uri(rShape["path"].ToString() + ".dbf", UriKind.RelativeOrAbsolute); vLayer.Reader = reader; vLayer.UseBitmapCache = false; vLayer.RefreshVirtualSource(); this.radMapNaveo.Items.Add(vLayer);Later I found that this is threading issue related to STA architecture, as it also throw the error "The calling thread must be STA,because many UI components require this". See the attachment.
Cheers.