i like to create dialogs by inheriting a radwindow.
This works fine if it is in the main silverlight project
but if it is placed in a silverlight class library the Visual Studio Designer errs out.
I can work around it by just
<
telerik:RadWindow
x:Class
=
"agClassLibrary.TraceWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:controls
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:dataFormToolkit
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
WindowStartupLocation
=
"CenterOwner"
Header
=
""
MinWidth
=
"400"
MinHeight
=
"250"
mc:Ignorable
=
"d"
d:DesignHeight
=
"250"
d:DesignWidth
=
"400"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
ListBox
Name
=
"lbMessage"
>
</
ListBox
>
</
Grid
>
</
telerik:RadWindow
>
Imports
System.Windows.Data
Imports
Telerik.Windows.Controls
Imports
System.ComponentModel
Imports
System.ComponentModel.DataAnnotations
Imports
System.Collections.ObjectModel
Imports
agClassLibrary
Imports
System.Linq
Imports
System.ServiceModel.DomainServices.Client
Imports
System.Runtime.CompilerServices
Partial
Public
Class
TraceWindow
Inherits
RadWindow
Protected
lstMessages
As
New
ObservableCollection(Of
String
)
<Display(Name:=
"MaxMessages"
, Description:=
"MaxMessages"
)> _
Public
Property
MaxMessages()
As
Integer
Get
Return
_MaxMessages
End
Get
Set
(
ByVal
value
As
Integer
)
_MaxMessages = value
End
Set
End
Property
Protected
_MaxMessages
As
Integer
= 500
Public
Sub
New
()
InitializeComponent()
lbMessage.ItemsSource = lstMessages
End
Sub
Protected
Sub
AddMessage(
ByVal
message
As
String
)
Dim
TraceMessage
As
String
= Now &
" --> "
& message
lstMessages.Add(TraceMessage)
System.Diagnostics.Debug.WriteLine(TraceMessage)
End
Sub
Public
Sub
Trace(
ByVal
EntitySet
As
EntitySet)
Trace(EntitySet.EntityType.ToString &
":"
& EntitySet.Count)
End
Sub
Public
Sub
Trace(
ByVal
message
As
String
)
If
lbMessage.Items.Count > MaxMessages
Then
lbMessage.Items.RemoveAt(0)
End
If
AddMessage(message)
lbMessage.ScrollIntoView(lbMessage.Items(lbMessage.Items.Count - 1))
End
Sub
End
Class
This works fine if it is in the main silverlight project
but if it is placed in a silverlight class library the Visual Studio Designer errs out.
System.InvalidOperationException
An unhandled exception was encountered while trying to render the current silverlight project on the design surface.
To
diagnose this failure, please try to run the project in a regular browser using the silverlight developer runtime.
at Microsoft.Windows.Design.Platform.SilverlightViewProducer.OnUnhandledException(
Object
sender, ViewUnhandledExceptionEventArgs e)
at Microsoft.Expression.Platform.Silverlight.SilverlightPlatformSpecificView.OnUnhandledException(
Object
sender, ViewUnhandledExceptionEventArgs args)
at System.EventHandler`1.Invoke(
Object
sender, TEventArgs e)
at Microsoft.Expression.Platform.Silverlight.Host.SilverlightImageHost.<>c__DisplayClass1.<Application_UnhandledException>b__0(
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)
System.Exception
The Extender Provider failed to return an Extender for this object.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_InsertValue[T](PresentationFrameworkCollection`1 collection, UInt32 index, CValue value)
at MS.Internal.XcpImports.Collection_InsertDependencyObject[T](PresentationFrameworkCollection`1 collection, UInt32 index, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.InsertDependencyObject(Int32 index, DependencyObject value)
at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement value)
at Microsoft.Expression.Platform.Silverlight.Host.SilverlightImageHost.SceneWrapper.set_SceneRoot(FrameworkElement value)
at Microsoft.Expression.Platform.Silverlight.Host.SilverlightImageHost.set_RootInstance(
Object
value)
I can work around it by just
- not inheriting radwindow
- creating a usercontrol and then
- instantiating a radwindow
- assigning the content of the radwindow to the usercontrol
But i prefer seeing the radwindow border in the desginer
is there anything obvious i am doing wrong
thanks
dco