silverlight-4.0

DataTemplate vs ItemContainerStyle

僤鯓⒐⒋嵵緔 提交于 2019-12-03 13:43:14
I've seen a few other Silverlight 'vs' questions around, but couldn't find any for this particular match-up. I'm trying to define the way in which my objects bound to a ListBox will display. I've defined a DataTemplate , but I'm really not sure where this should end and the ItemContainerStyle should begin. Question 1: Is the ItemContainerStyle just a wrapper for the DataTemplate so that a common item style can be applied to different data layouts? Question 1a: If so, in the event that a common item style isn't required, is the ItemContainerStyle even necessary or can all the layout and styling

Get the ListBoxItem in a ListBox

南笙酒味 提交于 2019-12-03 10:53:49
I am trying to change the Control template on a ListBoxItem when It is selected from the ListBox. To do so, I was going to get the selected ListBoxItem from the ListBox itself, and set the control template on that. How would i go about doing this? I have tried, SelectedItem and that returns the bound object within the ListBoxItem. You can retrieve the item container from the bound item by using the ItemContainerGenerator : object selectedItem = listBox.SelectedItem; ListBoxItem selectedListBoxItem = listBox.ItemContainerGenerator.ContainerFromItem(selectedItem) as ListBoxItem; Now you can do

How to configure WCF to push real-time data to the client?

做~自己de王妃 提交于 2019-12-03 08:27:46
I need to send live updates from server to client. I know that WCF generally can do this. However silverlight is a picky client.. Does anyone know how to configure WCF to send the real-time updates to Silverlight client? Snipets from configs and walkthrough will be greatly appreciated. Use WCF Callbacks. A good walkthrough that shows several configurations for this is available on the MSDN . We used the NetTCPBinding at my last job to great effect. It's very fast and efficient. The downside is that it doesn't support secure transport on Silverlight, so if that's a requirement you'll need to go

Can we concat two properties in data binding?

允我心安 提交于 2019-12-03 08:08:31
问题 Can we concat two properties together in binding expression? If possible without converter or without writing two textblocks and setting them individually? 回答1: Like alpha-mouse suggests MultiBinding won't work out of the box, but this guy has thrown something together that might help: http://www.olsonsoft.com/blogs/stefanolson/post/Improvements-to-Silverlight-Multi-binding-support.aspx If that seems a bit rogue, then maybe try putting a combined value property on your object as a helper for

Silverlight HttpWebRequest.Create hangs inside async block

断了今生、忘了曾经 提交于 2019-12-03 07:16:47
I am trying to prototype a Rpc Call to a JBOSS webserver from Silverlight (4). I have written the code and it is working in a console application - so I know that Jboss is responding to the web request. Porting it to silverlight 4, is causing issues: let uri = new Uri(queryUrl) // this is the line that hangs let request : HttpWebRequest = downcast WebRequest.Create(uri) request.Method <- httpMethod; request.ContentType <- contentType It may be a sandbox issue, as my silverlight is being served off of my file system and the Uri is a reference to the localhost - though I am not even getting an

What are the pitfalls of using .NET RIA Services in Silverlight?

梦想与她 提交于 2019-12-03 06:02:51
Silverlight can use WCF, Web Services, REST based services, .NET RIA Services, but it seems like Silverlight and .NET RIA Services are preferred most. I want to know if there are any common issues [which can be a show stopper if one goes ahead with this combo] that you have seen in practical implementation of SL with .NET RIA Services. Thanks, Rahul Working with metadata (and writing it by yourself) is really pain in the ass. Especially when you need to update your model. RIA tutorial applications look quite well on a small database but working with a model consisting of dozens of entites, you

Non breaking space in XAML vs. code

时间秒杀一切 提交于 2019-12-03 05:57:50
This works fine, and correctly inserts non-breaking spaces into the string: <TextBlock Text="Non Breaking Text Here"></TextBlock> But what I really need is to replace spaces with non-breaking spaces during data binding. So I wrote a simple value converter that replaces spaces with "   ". It does indeed replace spaces with "   " but "   " is displayed literally instead of showing as a non-breaking space. This is my converter: public class SpaceToNbspConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, CultureInfo

Silverlight RIA Services - How To Best Handle Client Auth Session Timeout?

不问归期 提交于 2019-12-03 05:19:46
问题 I built an app with Silverlight4, RIA Services, and I'm using ASP.NET Membership for authentication/authorization. My web.config has this: <system.web> <sessionState timeout="20"/> <authentication mode="Forms"> <forms name="_ASPXAUTH" timeout="20"/> </authentication> I have read a number of different strategies on how to deal with auth/session timeout on the client side. That is: if the client is idle for x minutes (20 here), and then they do something with the UI that triggers a RIA/WCF call

how to bind width of child element to width of parent element in silverlight

旧时模样 提交于 2019-12-03 04:08:14
问题 I have a grid whose width is "1*". So the actual width decided at runtime I think. Within that grid I have another grid whose width I want to set to the runtime width of parent grid. How Can I do that in xaml through binding. 回答1: This will actually help you I guess Width="{Binding ActualWidth, ElementName=parentElementName}" This binds the width to the parent element or the element name provided 回答2: This is generic solution which may work everywhere. You wouldn't need to write parent

Streaming a webcam from Silverlight 4 (Beta)

断了今生、忘了曾经 提交于 2019-12-03 03:54:33
问题 The new webcam stuff in Silverlight 4 is darned cool. By exposing it as a brush, it allows scenarios that are way beyond anything that Flash has. At the same time, accessing the webcam locally seems like it's only half the story. Nobody buys a webcam so they can take pictures of themselves and make funny faces out of them. They buy a webcam because they want other people to see the resulting video stream, i.e., they want to stream that video out to the Internet, a lay Skype or any of the