silverlight

Delay added to sound

I'm going to write an application in Silverlight that consists of 2 threads, one that plays sound and another that records sound. And whatever is recorded will be what was played plus some ambient noise. The problem is that Silverlight adds a delay to the sound to be played, and because I don't know how much is this delay, I would not k...

Silverlight asserting in release builds

I'm just playing around with Windows Phone and trying to write an app for it. I can't seem to find a Trace.Assert in System.Diagnostics. This exists in .NET for the PC and lets me throw assertions in Release builds. I'm guessing that this is just something that's not a part of the silverlight toolkit. What is the correct way of enab...

Binding the IsEnabled property to whether a text block has data

I'm using silverlight for windows phone and I want to bind the IsEnabled property of a button to whether a textblock has text in it or not. In other words, I want my button to be enabled when the textblock's Text is not empty and disabled otherwise. Is it possible to do this purely in XAML using Styles/Setters/Triggers or any other mech...

Can you use WCF services with Windows Phone 7?

I've only been able to find a couple of people online mentioning this, and it seems to be as simple for them as adding the service reference. However, when I attempt to add a service reference for my WCF service (which works correctly in a regular console app, so I have ruled the WCF out as the problem) I receive a host of errors. War...

Occasionally online app data synchronisation

Hi, I am writing an application which consists of a master "server" database (most probably sqlite) and a client side replica with client specific records (again, Sqlite). The clients may only be online occasionally or may be on slow 3G connections; I need a solution to reliably synchronise content either on demand or at scheduled inter...

Using same XAML for SL and WPF themes

Hi, I want to define control styles in a resource dictionary and use those for theming of Silverlight 4 and WPF 4 applications with as little adaption as possible. Thats why I need to know all differences between SL and WPF theming, so that most of the XAML will work on both platforms with little to no changes. The only difference tha...

In Silverlight, how do I handle an error during an asynchronous call?

In my SL4 app, I have a call to a service, svc.SubmitAsync(). Since this is an async call, once the method is hit, my code goes on to the next line. This is fine as long as the user enters the correct user name and password. If they don't, EndSubmit() throws an exception. EndSubmit() is in References.cs, part of the auto-generated Silver...

How to Databind TextBox to Property in CodeBehind

Using Expression Blend ? Let's say I got: Public string FirstName{get;set;} Edited : 23/8/2010 Thanks for tha answers, But I'm Afraid people didn't understand my question. I do know how to Bind Data in Code or in XAML My question is if there is a way to do all that with the Expression Blend Interface without writing it directly. On...

How do I save Data in Silverlight C#?

I want to make to make a site where a user can post to a string shown on front page. how do i do this? ...

What is a meaningful format to save formatted text in the database?

I have an existing application that has some parts of formatted text-blocks (standard formats such as bold, italic, unordered list, …) saved in the database. Currently these text-blocks are saved in a custom xml format. The editor is created with a WPF-RichtTextBox. Since I have to make the editor more user-friendly and extend the appli...

how to create a silverlight resources assembly in code

I'd like to use the CSharpCodeProvider to create a Silverlight assembly and add fonts int it, but it seems that the CompilerParameters only support build as "embedded resource", which can not be use in the FontFamily Uri. Is there any way to create a assembly in code, and the resource's build action is "resource"? ...

Dynamically download font and embedded in Silverlight application

I'd like to download fonts from server only when needed and support font fallback, there could be many fonts, in order to reduce the download size, the fonts are compressed to different zip files. But there is only a FontSource can be set at a time, It seem that is not possible to support font fallback with different downloaded fonts ...

animation for custom property of collection type

Is animation for custom properties of array type supported? Animation for simple properties (of Point type for example) works fine for me. When I changed property to PointCollection type the code stopped working with the error: cannot resolve TargetProperty Points[0] on specified object. Property is defined as public static readonl...

How do I include XML data in a Windows Phone xap deployment?

I'm working on a WP7 app. The app will have a couple of XML files. Some are read-write, a couple are read-only. What are my options here? IsolatedStorage? Embedding as resources? I'll also need to know... How would I load the XML into XElements from either? How would I save from an XElement into either? ...

How can I toggle an Image's visibility in a ListBox' ItemTemplate based on SelectedItem

I have an Image inside an ItemTemplate for a ListBox. Is there a way in XAML to toggle its visibility based on the ListBox' SelectedItem? In other words, I want the image to be visible only if the ListBoxItem is selected, but want to avoid code-behind for that. Thanks. ...

Silverlight 4: how to setup properties of the control in custom list

I have a list of object and want to bind for display purposes to a list of custom controls. XAML code: <Pages:MyItemsControl ItemsSource="{Binding SquadFieldPlayers}"> <Pages:MyItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas Height="180" Width...

Silverlight 4 Foreground ColorAnimation

I am trying to animate the Foreground color of a hyperlinkbutton when the user MouseOver the control. I created a custom style in which I want to animate the Foreground color. The Foreground color is set like so <Setter Property="Foreground" Value="#FF73A9D8"/> In the visualStateManager section I have the following element for the Co...

How do I hook an event to a control that comes in dynamically as part of a DataTemplate?

I have a ListBox that uses DataTemplateSelector to dynamically decide what template to use based on the type of the item in the list. I now want to hook the events that could be fired by controls within the DataTemplate. For example, if one of the templates has a checkbox in it, I want the application using the control to be notified ...

Quick questions about updating code from RIA Services July Preview to RIA Services 1.0

I don't have much experience on the web services / database abstraction layer side of things for Silverlight, and am caught on an aspect of my porting effort. There was a core C# developer on the project that is no longer involved, and I'm working with code that he wrote. I'm updating code on a SL3 project with the RIA Services preview ...

What are the top 10 gotchas of Silverlight on Windows Phone 7?

I have been using Silverlight for quite a bit and am learning Windows Phone 7. Of course, this is very similar. However, what are the top issues to watch out for? ...