Skip to main content

Microsoft Silverlight

Unanswered Question Sliverlight Designer in VS2008 crashes, appears emptyRSS Feed

(0)

objectinator
objectin...

Member

Member

4 points

3 Posts

Sliverlight Designer in VS2008 crashes, appears empty

Hi, I have a usercontrol like the following:

 

<UserControl x:Class="SwistSiteNouveau.About"

xmlns="http://schemas.microsoft.com/client/2007"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="520" Height="220">

<Grid Opacity="100" Loaded="Grid_Loaded">

<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="#FF8A8A8A" />

<Canvas Margin="5, 7, 0, 5">

<Rectangle RadiusX="155" RadiusY="155" Canvas.Left="1" Canvas.Top="0" Width="480" Height="200">

<Rectangle.Fill>

<LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5" >

<GradientStop Offset="0" Color="Black" />

<GradientStop Offset="0.5" Color="Silver" />

</LinearGradientBrush>

</Rectangle.Fill>

</Rectangle>

<!-- Top Right Close Button -->

<Button x:Name="btnX" Canvas.Left="475" Canvas.Top="0" Click="CloseBtn_Click" Content="X" Width ="50" Height="25" Style="{ StaticResource SmallCloseButton}"/>

</Canvas>

</Grid>

</UserControl>

The Style="{ StaticResource SmallCloseButton}"/> makes the designer crashes when I reference this above control inside another control like so:

<UserControl x:Class="SwistSiteNouveau.Page2"

xmlns="http://schemas.microsoft.com/client/2007"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:Swist="clr-namespace:SwistSiteNouveau;assembly=SwistSiteNouveau">

 

<Grid Background="White" ShowGridLines="False">

<Grid.RowDefinitions>

<RowDefinition Height="120"/>

<RowDefinition Height="400"/>

<RowDefinition Height="80"/>

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition Width="250"/>

<ColumnDefinition Width="520"/>

<ColumnDefinition Width="30"/>

</Grid.ColumnDefinitions>

<Canvas Grid.Row="0" Grid.Column="1">

<!--Uncomment the line below in order to view Designer:-->

<Swist:About Canvas.Left="30" Canvas.Top="140" x:Name="About" Visibility="Collapsed"/>

</Canvas>

 

</Grid>

 

</UserControl>

When I remove the line that sets the style in the control then it works (Style="{ StaticResource SmallCloseButton}"/>)

Please help

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Re: Sliverlight Designer in VS2008 crashes, appears empty

Hello, I think you have some error in your markup. First, where's the Style SmallCloseButton? Also, Opacity should range from 0 to 1. In Blend, you can find Opacity value of 100%. But 100% = 1, right? Finally, make sure you have the proper event handlers in code.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

objectinator
objectin...

Member

Member

4 points

3 Posts

Re: Re: Sliverlight Designer in VS2008 crashes, appears empty

thanx for the reply.  No, nothing is wrong with the markup here is the SmallCloseButton Style below:  if you copy all my code you will also get the designer to "not show" because it's a bug I'm sure.  When you remove the reference to the SmallButton style it works.  Also, it's only the designer view that crashes, as it runs fine in the browser. Scot Gu's Digg sample does the same thing - download his code here: http://www.scottgu.com/blogposts/slbeta1apps/diggsample.zip

and see what I mean.  The page.xml file when open in Designer view shows an empty designer, yet it runs fine.  The problem is the bug when you reference a user control inside another usercontrol and the referenced user control has a reference to a style for a button for example.

 

<Application xmlns="http://schemas.microsoft.com/client/2007"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

x:Class="SwistSiteNouveau.App"

>

<Application.Resources>

<LinearGradientBrush x:Key="MyBrush" EndPoint="0.5,1" StartPoint="0.5,0">

<GradientStop Color="#FF989898"/>

<GradientStop Color="#FFFFFFFF" Offset="1"/>

</LinearGradientBrush>

<Style x:Key="MyButtonStyle" TargetType="Button">

<Setter Property="Width" Value="250"/>

<Setter Property="Height" Value="35"/>

<Setter Property="FontSize" Value="14"/>

<Setter Property="Margin" Value="5"/>

</Style>

<Style x:Key="MyBorderStyle" TargetType="Border">

<Setter Property="Padding" Value="15"/>

<Setter Property="CornerRadius" Value="20"/>

<Setter Property="HorizontalAlignment" Value="Center"/>

<Setter Property="VerticalAlignment" Value="Top"/>

<Setter Property="Margin" Value="0,15,0,0"/>

<Setter Property="Background" Value="{StaticResource MyBrush}"/>

</Style>

<Style x:Key="TitleBorder" TargetType="Border">

<Setter Property="CornerRadius" Value="10"/>

<Setter Property="Background" Value="#FFDEDEDE"/>

<Setter Property="Margin" Value="0,0,5,0"/>

<Setter Property="Grid.Column" Value="0"/>

</Style>

<Style x:Key="TitleText" TargetType="TextBlock">

<Setter Property="FontFamily" Value="Trebuchet MS"/>

<Setter Property="FontSize" Value="16"/>

<Setter Property="Foreground" Value="#FF14517B"/>

<Setter Property="Margin" Value="10,3,0,0"/>

</Style>

<Style x:Key="TopGrid" TargetType="Grid">

<Setter Property="Background" Value="#FF5C7590" />

</Style>

<Style x:Key="Header" TargetType="Grid">

<Setter Property="Margin" Value="7" />

<Setter Property="Grid.Row" Value="0"/>

</Style>

<Style x:Key="AboutButton" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="60" Height="60">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Black"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="ABOUT US!" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="SmallCloseButton" TargetType="Button">

<Setter Property="HorizontalAlignment" Value="Right"/>

<Setter Property="Width" Value="50"/>

<Setter Property="Height" Value="25"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Border x:Name="brd1" Width="22" Height="22" CornerRadius="15">

<TextBlock x:Name="txt1" Foreground="#222" TextAlignment="center" Text="r" FontSize="11" VerticalAlignment="center" FontFamily="Webdings"/>

<Border.Background>

<RadialGradientBrush GradientOrigin=".3, .3">

<GradientStop Color="#FFF" Offset=".15"/>

<GradientStop Color="#777" Offset="1"/>

</RadialGradientBrush>

</Border.Background>

</Border>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="ExploreButton" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="200" Height="200">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Crimson"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="GO!" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="MobilButton" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="100" Height="100">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Crimson"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Mobility Solutions" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="InfraButton" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="100" Height="100">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Crimson"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Infrastructure Services" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="DevButton" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="100" Height="100">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Crimson"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Development" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="CloseButton2" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="40" Height="40">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Black"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Foreground="White" Content="Go" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

 

<Style x:Key="btnBillingAcc" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="40" Height="40">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Black"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Inteliigent Data Management Solutions" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="btncutDataManSolutions" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="40" Height="40">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Black"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Inteliigent Data Management Solutions" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

<Style x:Key="btncustSolutions" TargetType="Button">

<Setter Property="Margin" Value="15"/>

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid>

<Ellipse Width="40" Height="40">

<Ellipse.Fill>

<RadialGradientBrush GradientOrigin=".2,.2">

<GradientStop Offset="0.2" Color="White"/>

<GradientStop Offset="1" Color="Black"/>

</RadialGradientBrush>

</Ellipse.Fill>

</Ellipse>

<ContentPresenter Content="Custom Solutions" HorizontalAlignment="Center" VerticalAlignment="Center"/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

</Application.Resources>

</Application>

objectinator
objectin...

Member

Member

4 points

3 Posts

Re: Re: Sliverlight Designer in VS2008 crashes, appears empty

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities