silverlight

How can I attach a mouse event to a Run object in Silverlight?

I can attach a mouse-click event to a TextBlock object like this: TextBlock tb = new TextBlock(); tb.Text = "click here"; tb.MouseLeftButtonDown += new MouseButtonEventHandler(tb_MouseLeftButtonDown); But I would like to instead attach the mouse-click to individual Run objects inside the TextBlock object so that various parts of the T...

Silverlight DoubleAnimation causes WCF service response delays

I have Silverlight application that calls WCF services. During the call it shows fullscreen animation - spinning circle on top of semi-transparent modal popup. The problem is, if animation is shown, the service calls are often finished with big delays (if at all), especially if there're multiple calls. If I remove one line to .Begin() an...

Silverlight -- how to display element based on user security

I am a Silverlight newbie... I want a page to display elements (button, grid, images) based on the current user security role. Basically, I would like to attach to an element the required security role and have my code being called to decide whether the element will show or not. Something like (adding an attribute RequiredRole) <Butto...

How can I add an underline to a HyperlinkButton in Silverlight?

It seems I can format a HyperlinkButton in the same way I can format a TextBlock: HyperlinkButton hyperlinkButton = new HyperlinkButton(); hyperlinkButton.Content = "google"; hyperlinkButton.NavigateUri = new Uri("http://www.google.com"); hyperlinkButton.TargetName = "blank"; hyperlinkButton.Foreground = XamlHelpers.GetColorFromHex("555...

Databinding with Dependency Property callbacks and Animation within the Static Method

Before I start, I have this code inside of a Custom Usercontrol: private DependencyProperty _rotation = DependencyProperty.Register("Rotation", typeof(double), typeof(MyControl), new PropertyMetadata(new PropertyChangedCallback(RotationPropertyChanged))); public double Rotation { ge...

In Silverlight, how to bind ListBox item selection to a Navigate event?

I am writing a windows-phone 7 application. I've got a page with a list of TextBlock(s) contained in a ListBox. The behavior I want is that upon clicking one of those TextBlock(s) the page is redirected to a different one, passing the Text of that TextBlock as an argument. This is the xaml code: (here I am binding to a collection of st...

Silverlight ListBox - static plus bound items

Is there any way to have a listbox populated by both static and dynamic items? I am writing a windows phone 7 app and would like to have one static listboxItem at the top or bottom and then bind other items from the viewModel. I tried setting both a static listboxItem and then also a dataTemplate but the static item is replaced by th...

Silverlight Project Advice - Sharing resources between projects in Solution/Projects

My Visual Studio solution has many projects within it, like a DAL, BLL, UI Forms, etc. It is getting quite large and now, my Silverlight project that contains all of the UI controls will be splitting up into other more modular projects. Currently, within my Silverlight project, I have a Resources folder where it has Styles.xaml and oth...

How Do I Unit Test Silverlight 3 in VS2010?

I am currently working on a project that uses the Silverlight 3 SDK and I want to create unit tests for my Silverlight code. I want these tests to not have to run in a browser context. I have referenced the Silverlight Unit Testing binaries that come in the SDK (Microsoft.Silverlight.Testing and Microsoft.VisualStudio.QualityTools.UnitTe...

XAML ~ Need help with the Binding syntax for collection of objects

I am trying to bind a List of objects to an ItemsControl. The object has only two properties: Movie (a string) and Actors (an array of string). I can get the binding to work fine for the Movie. But I can't figure out the binding for the Actors array. <ItemsControl x:Name="MovieList"> <ItemsControl.ItemTemplate> <DataTemplat...

Silverlight and SSL Client Certificates

Can anyone point me in the right direction of how I can use SSL client-side certificates with Silverlight to access a restful web service? I can't seem to find anything on how to handle them, or even whether they are supported. Cheers. ...

What is the best way to collapse an optional Grid Column at runtime?

Currently I have a Grid with 6 optional fields, one on each row, in a data template bound to my view model. 6 Rows - 2 Columns Column 0 has the label Column 1 has the content associated with the label. In this case I want to collapse the column when the Column 0 label is null. My plan is to simply create a converter, if content is ...

Silverlight Without XAML - Images Will Not Render

I have a Silverlight application in which I'm not using XAML. I have a basic application with the following code in Application_Startup: private void Application_Startup(object sender, StartupEventArgs e) { Grid g = new Grid(); g.Children.Add(new Image { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("http://ss...

Listbox styling and control template issue in silverlight...

Hi all, I have to change Listbox's control templated in a way that it can look like below image i have added togglebutton in listboxdatatemplate... have one stackpanel in listbox style template... so structure is like border - stackpanel - grid - itemcontainer[boder-togglerbutton] now to make first and last item curved... what are th...

visual studio 2008 loading template problem

hi, i was trying to create a new silverlight solution using visual studio 2008 and am getting the following error: Error: this template attempted to load an untrusted component 'Microsoft.VisualStudio.Silverlight, Version=9.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a'. For more information on this problem and how to enable...

Dynamically creating checkboxes from database using MVVM

Hi, How to create dynamic checkboxes at run time from the databases values using MVVM pattern. I have set all the table columns as get;set; properties in Model. But not getting how to create the checkboxes using MVVM and where to put what means where to put database connections and functions for that and how to bind the dynamically crea...

Debugging silverlight application problem

hi guys, My VS2010 doesn't stop at breakpoints inside of silverlight application. It appears that no symbols for it have been loaded during debugging. When I hover over the break point it says "The braekpoint will not currently be hit, no symbols have been loaded". I have tried all of possible solutions offered by google and have no su...

How to stop the Silverlight Child Window from being dragged off screen

In our Silverlight 3 project, I am using the ChildWindow control to display several system dialogs. This presents the dialog in a modal window that the user can then drag around if required. The problem is that it is actually possible for them to drag the ChildWindow off screen, so that it cannot be picked up again and dragged back on ...

Problem with GridSplitter not resizing content

Hi, First off I'm new to XAML so forgive me if I've done something stupid. I have stripped down my page to the following example XAML (viewable in XamlPad): <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xam...

Silverlight 3 breakpoints not hit when launching external program

I'm using Visual Studio 2008, Silverlight 3 and IE 6 (don't ask). I'm trying to launch and debug the application with F5, but the debugger says my breakpoints won't be hit because the symbols aren't loaded. My default browser is actually Firefox, but I am setting the Start Action of the project to specifically launch IE and point it at...