This is a migrated thread and some comments may be shown as answers.

class library inheritance

3 Answers 49 Views
Window
This is a migrated thread and some comments may be shown as answers.
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
David Ocasio asked on 03 Mar 2011, 04:19 PM
i like to create dialogs by inheriting a radwindow.
<telerik:RadWindow x:Class="agClassLibrary.TraceWindow"
    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

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 09 Mar 2011, 01:13 PM
Hello David Ocasio,

I've tried to reproduce this issue but to no avail. I've attached my test projects, could you please download the attachment and examine it?

Regards,
Yana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 19 Mar 2011, 03:24 PM
sorry so late for a continuation of the thread

nevertheless

i think i have found the answer or at least a direction

with the release of 2011 q1 i felt the need to remove all othe older versions of radcontrols instead of just upgrading the projects
i also removed the extentions and deleted the roaming appdata telerik uses

it seems for now that this is working
i can now inhertit the radwindow and have it display in the designer properly

if this changes of course i will be back lol

thanks for your assitance
dco
0
Yana
Telerik team
answered on 21 Mar 2011, 09:20 AM
Hello David Ocasio,

I'm glad you managed to fix the problem.

Please contact us again should you have any other issues.

Greetings,
Yana
the Telerik team
Tags
Window
Asked by
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Yana
Telerik team
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or