silverlight

How to force ListBoxItem to 'hydrate' ItemTemplate, and bind to its DataSource Item?

Hello: In the OnMeasureOverride of a custom Panel within measureOverride, I need to look at the contents of what the end user will have supplied via ItemTemplate... But the ListBoxItem element (the Panel's Child) is ...empty. It's ContentPresenter has not yet been filled in with the ItemTemplate's contents. The only solution I found wa...

Silverlight Dataform Question

Whenever a user adds a new record to the dataform I want to auto populate a field(integer datatype) with a default value, but I am not sure how to do this. I should also mention that I am populating the dataform using RIA services. Any ideas? ...

Is it possable to add a DataField to a Silverlight DataForm without creating an entire edit template?

I am using the DataForm for an entity with about 40 attributes. I'm happy with how the form displays all but 3 of the attributes. These 3 attributes happen to be lists of items. I don't want to have to code out an entire edit template, seems very counter productive. <dataFormToolkit:DataForm AutoGenerateFields="True" CurrentItem="{Bind...

.NET RIA services metadata and foreign keys

I’m using Silverlight and the .NET RIA Services. I’ve generated an entity data model from a database, created one domain class service for all the tables and chosen to generate the metadata. Now, when trying to build I get errors in metadata that contain foreign keys in the generated file App.Web.g.cs. The problem is there are lots...

How do I replace a ControlTemplate part at runtime, in Silverlight 3?

I'm writing a custom control which uses a template defined in the resources section of my XAML and I'd like to replace one or more template parts in an instance of my control at runtime. For example, if I have a part named "ActivePart" in the control's template, how do I replace the ActivePart's FrameworkElement in an instance of the co...

Problem with WCF and multiple namespaces - sharing object types across multiple service references

Hi, i have two web services. One with user functionality, one with admin functionality. Both services effectively work with the same object types, for instance: AdminService provides functionality for deleting/modifying Customer objects UserService provides functionality for listing/reading Customer objects Now in the client i have...

EventManager in silverlight app

When trying to use the following EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotFocusEvent, new RoutedEventHandler(TextBox_GotFocus)); I am getting an error on 2nd parameter: "'System.Windows.Controls.TextBox' does not contain a definition for 'GotFocusEvent'" Any help how to resolve this? I am in the process of addi...

Handle Silverlight 4 RichTextBox Paste event

How can I handle the Paste event for a RichTextBox control in Silverlight 4? (I want to be able to copy-paste images - the Clipboard in SL4 supports only text, so I'm sending the ImageSource Uri, and on the Paste event I want to load the image in the RichTextBox instead of the Uri string). ...

Feasibility of shared code between .NET and Silverlight?

Having just gone through a small experimenting session to try to see how much work it would take to bring our .NET class library, or at least portions of it, into Silverlight so that we can reuse business logic between the two worlds, I'm wondering if others have experience with this sort of thing. The things I noticed, off the top of m...

Tools for Silverlight and .NET parallel programming?

An upcoming project at work looks like it might involve Silverlight. We're a .NET shop without all that much Silverlight-experience, but it looks like we need to ramp up our knowledge for this. So I'm wondering, what tools should we get? We are using Visual studio 2008, and will most likely not be able to jump to .NET 4.0, although we ...

Silverlight Toolkit DatePicker error indicator

I don't seem to be able to get the red border line error provider for my date picker controls. I'm throwing validation exceptions on the setter of the bound to property as I have with my other controls on the form. I get the error indicator on all my controls on the form but the date picker ones. any help appreciated. ...

Absurd problem displaying silverlight video player on differing domains

I'm having a problem displaying two silverlight movies from different domains. They are both in the bindings of IIS, both are redirected to my private computer/server and both are loading a silverlight plugin into the browser. The first domain displays the movies and the contents of the silverlight. The second one doesn't. The first d...

How does inheritance of FontSize in silverlight tree work?

If I have a ChildWindow in Silverlight I can apply the FontSizeProperty and it is inherited by child items. <controls:ChildWindow FontSize="14"> <StackPanel> <TextBlock Content="Hello"> <TextBlock Content="World"> </StackPanel> </controls:ChildWindow> Now that's fine if you want the whole page to have t...

ADO.NET Data Services on Silverlight: Using the generated key within the same transaction

We have a Silverlight application that uses WCF Data Services. We want to add logging functionality: when a new row is generated, the primary key for this new row is also recorded in the logging table. The row generation and the logging should occur within the same transaction. The primary keys are generated via the database (using the I...

Sharing a T4 template between Silverlight and .NET

I am looking at sharing my class library code between .NET 3.5 and Silverlight 3. Since I am mainly developing for .NET, I am looking at auto-generating the Silverlight project file(s) from the corresponding .NET project file(s). Thus, I have a T4 file, which complains in Silverlight with the following error message: Error 1 Comp...

Prism for Silverlight : How to maintian views in specific order inside a region.

Hi I am creating sort of a "Navigation panel" (which is actually an ItemControl) for SL and using Regions to allow each module to add his link to the panel. Problem is that modules loading is inconsistent and thus order of links in the panel can change according to modules loading order. Restricting the modules order is out of the que...

In Silverlight, how do you find out whether the code is running in the UI thread or not?

Basically I need to know whether I need to can Dispatcher.BeginInvoke or if it's not needed. Thanks. ...

Setting a custom control's aspect ratio

Is there a way, using XAML (and possibly Template Bindings) to keep a control's width in a certain proportion to its height? I would like for my control, at design time in Blend, to always scale evenly. ...

Silverlight: Access REST service behind forms authentication site

I am new to Silverlight, and I building a simple app which provides an interface for an expense report portal. The portal has a REST API which I can access; I know I can do it using WebClient or WebHttpRequest. However, to be able to access the API, I need to login first. The login is simple forms authentication on login.aspx of the site...

Silverlight: Can I create a custom button which contains two TextBlocks, each of which binds to a different property on an object?

I want to make buttons similar to those on this website. Lets say that the object I'm working with is ArtPiece, and has a Title and Date. I want both of those to show up on my buttons in two different TextBlocks. I've been trying to modify the button's ContentTemplate, then modifying the button's ContentPresenter inside the ContentTem...