RadWindow.Alert will not play nice with async operations as follows...
await _datacontext.SaveChangesAsync().ContinueWith((args) => {
RadWindow.Alert("Saved!", "Success!");
}).ConfigureWait(false);
or
await _datacontext.SaveChangesAsync().ConfigureWait(false);
RadWindow.Alert("Saved!", "Success!");
throws this...
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in WindowsBase.dll
Additional information: Exception has been thrown by the target of an invocation.
Exception:Thrown: "The calling thread must be STA, because many UI components require this." (System.InvalidOperationException)
A System.InvalidOperationException was thrown: "The calling thread must be STA, because many UI components require this."
Time: 11/30/2013 13:51:44
Thread:Worker Thread[6864]
I thought it was just me and Caliburn.Micro but its truly the control...
-Windows 8.1, Desktop Application, Lastest controls, Visual Studio 2013, Entity Framework 6.0-
private
void
dataGrid_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
chartdatas.Clear();
chartdatas2.Clear();
VariablesDescription temp = ((DataGrid)sender).SelectedItem
as
VariablesDescription;
if
(temp !=
null
)
{
UpdateVariablesLabels(temp.Name);
if
(temp !=
null
)
{
string
name = temp.Name;
foreach
(ModelVariable model
in
this
.data.ModelVariables)
{
string
comp = model.variableName;
string
[] word = comp.Split(
'.'
);
string
ToCompar = word[word.Length - 1];
if
(ToCompar == name)
{
for
(
int
i = 0; i < model.modalities.Count; ++i)
{
Modality modality =
this
.data.ModelVariables[2].modalities[i];
CharDataclass cd =
new
CharDataclass();
CharDataclass cd2 =
new
CharDataclass();
cd.XValue = modality.Percent_target;
cd.YValue = i;
cd2.YValue = i;
chartdatas.Add(cd);
cd2.XValue = modality.Percent_in_universe;
chartdatas2.Add(cd2);
}
graph1.Series[0].ItemsSource = chartdatas;
graph2.DataContext = chartdatas2;
}
}
}
}
}
<
telerik:RadCartesianChart
Height
=
"240"
HorizontalAlignment
=
"Left"
Margin
=
"448,408,0,0"
Name
=
"graph1"
VerticalAlignment
=
"Top"
Width
=
"486"
Zoom
=
"10,1"
>
<
telerik:RadCartesianChart.Behaviors
>
<
telerik:ChartPanAndZoomBehavior
PanMode
=
"Horizontal"
ZoomMode
=
"Horizontal"
/>
</
telerik:RadCartesianChart.Behaviors
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:CategoricalAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
HorizontalLocation
=
"Left"
Name
=
"Axis1"
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:BarSeries
CategoryBinding
=
"YValue"
ItemsSource
=
"{Binding}"
ValueBinding
=
"XValue"
>
<
telerik:BarSeries.PointTemplate
>
<
DataTemplate
>
<
Rectangle
Fill
=
"Black"
/>
</
DataTemplate
>
</
telerik:BarSeries.PointTemplate
>
</
telerik:BarSeries
>
<
telerik:LineSeries
CategoryBinding
=
"YValue"
ItemsSource
=
"{Binding}"
Name
=
"graph2"
ValueBinding
=
"XValue"
>
<
telerik:LineSeries.PointTemplate
>
<
DataTemplate
>
<
Ellipse
Fill
=
"Red"
Height
=
"7"
Width
=
"7"
/>
</
DataTemplate
>
</
telerik:LineSeries.PointTemplate
>
<
telerik:LineSeries.VerticalAxis
>
<
telerik:LinearAxis
HorizontalLocation
=
"Right"
Name
=
"Axis2"
/>
</
telerik:LineSeries.VerticalAxis
>
</
telerik:LineSeries
>
</
telerik:RadCartesianChart
>
<
ScrollViewer
CanContentScroll
=
"True"
>
<
telerik:RadCarousel
x:Name
=
"carousel"
IsSynchronizedWithCurrentItem
=
"False"
HorizontalScrollBarVisibility
=
"Hidden"
Loaded
=
"carousel_Loaded"
Height
=
"309"
>
<
telerik:RadCarousel.ReflectionSettings
>
<
telerik:ReflectionSettings
HiddenPercentage
=
"0"
OffsetY
=
"0"
Opacity
=
"0"
Visibility
=
"Collapsed"
/>
</
telerik:RadCarousel.ReflectionSettings
>
<
Grid
Height
=
"111"
Width
=
"111"
>
<
Grid.Background
>
<
ImageBrush
ImageSource
=
"a.png"
/>
</
Grid.Background
>
</
Grid
>
<
Grid
Height
=
"111"
Width
=
"111"
>
<
Grid.Background
>
<
ImageBrush
ImageSource
=
"b.png"
/>
</
Grid.Background
>
</
Grid
>
<
Grid
Height
=
"111"
Width
=
"111"
>
<
Grid.Background
>
<
ImageBrush
ImageSource
=
"c.png"
/>
</
Grid.Background
>
</
Grid
>
</
telerik:RadCarousel
>
</
ScrollViewer
>
</
Grid
>
<
telerik:InformationLayer
Name
=
"InformationLayerShape"
ItemsSource
=
"{Binding LayerShapes}"
>
<
telerik:InformationLayer.ItemTemplate
>
<
DataTemplate
>
<
views:MapPolygon
Points
=
"{Binding Locations}"
Fill
=
"#99FFFF00"
StrokeThickness
=
"4"
Visibility
=
"{Binding Visibility}"
CaptionLocation
=
"{Binding CaptionLocation}"
Opacity
=
".5"
>
<
views:WaterMapPolygon.CaptionTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding CaptionText}"
/>
</
DataTemplate
>
</
views:WaterMapPolygon.CaptionTemplate
>
</
views:MapPolygon
>
</
DataTemplate
>
</
telerik:InformationLayer.ItemTemplate
>
</
telerik:InformationLayer
>
<
TextBlock
Text
=
"{Binding CaptionText}"
/>
with <
TextBlock
Text
=
"Display this caption."
/>
the text is displayed.<
Style
TargetType
=
"telerik:RadMaskedNumericInput"
>
<
Setter
Property
=
"FontWeight"
Value
=
"Normal"
/>
<
Setter
Property
=
"Width"
Value
=
"100"
/>
<
Setter
Property
=
"TextMode"
Value
=
"PlainText"
/>
<
Setter
Property
=
"IsClearButtonVisible"
Value
=
"True"
/>
<
Setter
Property
=
"AllowSkipPlaceholders"
Value
=
"False"
/>
<
Setter
Property
=
"AutoFillNumberGroupSeparators"
Value
=
"False"
/>
<
Setter
Property
=
"SelectionOnFocus"
Value
=
"CaretToEnd"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Left"
/>
<
Setter
Property
=
"input:MaskedInputExtensions.Maximum"
Value
=
"99999"
/>
<
Setter
Property
=
"Mask"
Value
=
""
/>
</
Style
>
In my application I am using telerik:GridViewImageColumn.
My scenario is I am assigning collection to gridview each object row contains the byte array of image. Collection contains more than 1000 rows. Actually collection is for my company product users. We have few products (say 10).
I am showing those product user details in gridview with product image. Each user row contains product image byte array.
After assigning data source when I scroll the gridview sometimes getting exception “Target invocation exception”Exception type: TargetInvocationException
Source: mscorlib
-------======== InnerException ========
Description: The value should not null.
Parametername: uriSource
Exception type: ArgumentNullException
Source: PresentationCore
Stack Trace:
System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource, RequestCachePolicy uriCachePolicy)
Telerik.Windows.Controls.GridViewImageColumn.image_ImageFailed(Object sender,
ExceptionRoutedEventArgs e)
My xaml code for assigning data member is
<telerik:GridViewImageColumn Header="" UniqueName="colProductImage" DataMemberBinding="{Binding ProductImage}" ImageHeight="20" ImageWidth="20" />
What could be the solution for above problem?
My idea is to avoid above problem, instead of loading image byte data for each row just loads all 10 products data in
one collection and give the reference to image column with collection index. If it is possible please tell how to do .
Thanks for help.
Naresh Mesineni