ContextMenu.MenuItem.Icon , Image does not load
-
Tuesday, May 17, 2011 12:58 PM
Hello,
I've got a contextmenu in silverlight 4 that does not load icon images.
Well, there's is one case when the image is load : when the same image appears in a control in the page.
Does anyone have an idea for this problem ?
I noticed that : "A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll" was thrown each time the icon should be draw unless the image is already present in th document<UserControl.Resources> <Converters:DateConverter x:Key="DateConv"/> <Namespace_ConsoleSilverlight_ViewModel:FooterViewModel x:Key="FooterViewModelDataSource" d:IsDataSource="True"/> </UserControl.Resources> <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}" > <toolkit:ContextMenuService.ContextMenu> <toolkit:ContextMenu > <toolkit:MenuItem Header="Namespace" x:Name="Namespace" Click="Namespace_Click"> <toolkit:MenuItem.Icon> <Image Height="16" Width="16" Source="/Namespace.ConsoleSilverlight.Client;component/Assets/Resources/Images/128x128.png"/> </toolkit:MenuItem.Icon> </toolkit:MenuItem> <toolkit:MenuItem Header="Start"> <toolkit:MenuItem.Icon> <Image Height="16" Width="16" Source="/Namespace.ConsoleSilverlight.Client;component/Assets/Resources/Images/start.png"/> </toolkit:MenuItem.Icon> </toolkit:MenuItem> </toolkit:ContextMenu> </toolkit:ContextMenuService.ContextMenu> <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" > <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigating="ContentFrame_Navigating" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" Padding="0,30,0,40" > <navigation:Frame.UriMapper> <uriMapper:UriMapper> <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/> <uriMapper:UriMapping Uri="/Home/Agent/{AgentId}" MappedUri="/Views/Home.xaml?AgentId={AgentId}"/> <uriMapper:UriMapping Uri="/Home/Server/{ServerId}" MappedUri="/Views/Home.xaml?ServerId={ServerId}"/> <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/> </uriMapper:UriMapper> </navigation:Frame.UriMapper> </navigation:Frame> </Border> <Grid Style="{StaticResource NavigationOuterGridStyle}"> <Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}"> <Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}"> <StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}"> <Image Source="/Namespace.ConsoleSilverlight.Client;component/Assets/Resources/Images/128x128.png" /> <TextBlock x:Name="ApplicationNameTextBlock" Style="{StaticResource ApplicationNameStyle}" Text="{Binding Strings.ApplicationName, Source={StaticResource ApplicationResources}}"/> </StackPanel> </Border> <Border x:Name="LinksBorder" Style="{StaticResource LinksBorderStyle}"> <StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}"> <HyperlinkButton x:Name="Link1" Style="{StaticResource LinkStyle}" NavigateUri="/Home" TargetName="ContentFrame" Content="{Binding Strings.HomePageTitle, Source={StaticResource ApplicationResources}}"/> <Rectangle x:Name="Divider1" Style="{StaticResource DividerStyle}"/> <HyperlinkButton x:Name="Link2" Style="{StaticResource LinkStyle}" NavigateUri="/About" TargetName="ContentFrame" Content="{Binding Strings.AboutPageTitle, Source={StaticResource ApplicationResources}}"/> </StackPanel> </Border> </Grid> <Border Style="{StaticResource LoginContainerStyle}"> <login:LoginStatus x:Name="loginStatus"/> </Border> </Grid> <Grid VerticalAlignment="Bottom" x:Name="grdFooter" Background="#FF484848" Height="42" DataContext="{Binding Source={StaticResource FooterViewModelDataSource}}"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Text="{Binding CurrentInstance.TimeElaspedFromLastMessage,StringFormat='Dernier message reçu il y a : \{0:mm\\:ss\}'}" Foreground="White" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="12"/> <TextBlock Visibility="Collapsed" Grid.Column="0" Grid.Row="1" Text="{Binding CurrentInstance.LastMessage,StringFormat='Message : \{0\}'}" Foreground="White" Margin="5,0,0,0" FontSize="12" VerticalAlignment="Center"/> <TextBlock HorizontalAlignment="Right" Grid.Column="2" Grid.RowSpan="2" Text="{Binding CurrentInstance.CurrentTime,Mode=OneWay,Converter={StaticResource DateConv}}" Foreground="White" Margin="0,0,5,0" VerticalAlignment="Center" FontSize="12"/> </Grid> </Grid>
- Moved by Ciprian Duduiala Tuesday, May 17, 2011 2:21 PM wrong language (From:Silverlight)

