silverlight

WebClient - wait until file has downloaded

江枫思渺然 提交于 2019-12-18 09:24:26
问题 I'm developing a function to return a collection, generated from an xml file. Initially, I was using a local xml file for testing, but now I'm ready to have the app download the real xml file from a server. I'm struggling to see how I could do this due to the fact a WebClient object needs to be given an OpenReadCompleted event handler - I cannot return the collection data from this, and also by the time this handler executes, the original function has ended. My original code is as follows:

Distinct Values in WPF Combobox

跟風遠走 提交于 2019-12-18 09:08:15
问题 I would like to get distinct values in my databound combo box as an example the values it has are: blue, blue, yellow, red, orange I would like it to just display blue once. My main thought was to get all combo box values into an array, set the array as distinct and then re-populate the combo box. Is there any other way? If not how would I actually get all the values from the combo box? Thanks EDIT -- Class: public class DistinctConverter : IValueConverter { } EDIT -- Debug: 回答1: You could

ProtoBuf-net serializing IEnumerable<T>

两盒软妹~` 提交于 2019-12-18 07:50:05
问题 I'm trying to use ProtoBuf-NET in my project (it's mostly Silverlight 4 project). I'm having difficulties serializing my Model collections, they all are defined like this: private List<T> _itemsSet; public IEnumerable<T> TSet { get {return _itemsSet;} set {_itemsSet = value == null ? new List<T>() : new List<T>(value);} } public void AddT(T item) { //Do my logic here _itemsSet.Add(item); } Update: First I can't serialize it - No serializer defined for type: System.Collections.Generic

How to Set TargetNullValue to Visibility.Collapsed in Binding

心已入冬 提交于 2019-12-18 07:45:50
问题 I'm binding TextBlock.Visiblitiy to something, and I want to set the Binding.TargetNullValue to Collapsed , how can I do it in XAML? This one How do I set TargetNullValue to a date? does not work in Silverlight. (No x:Static ). 回答1: This is working for me in SL4: <TextBlock Text="Text" Visibility="{Binding Foo, TargetNullValue=Collapsed}"/> Where Foo: public Visibility? Foo { get; set; } 来源: https://stackoverflow.com/questions/8692862/how-to-set-targetnullvalue-to-visibility-collapsed-in

Convert Audio samples from bytes to complex numbers?

我怕爱的太早我们不能终老 提交于 2019-12-18 07:15:31
问题 Greetings everyone, I am currently developing a chromatic tuner for instruments/voice in Silverlight with a C# back-end. I am in the beginning stages and am having issues in grabbing the audio data. I am using an AudioSink class to write the audio to a memory stream when the live capture starts. The problem I am having is converting those bytes in the stream to complex numbers so that it can be fed into a FFT algorithm. I have tried the various way discussed in this post Problem to convert

HLSL for getting cylinder effect

帅比萌擦擦* 提交于 2019-12-18 07:14:53
问题 I need to write an application with Silverlight 4 and need to show images like wrapped on cylinder. I need some HLSL code, as I wont to do that with Effects of Silverlight. I don't wont to do that with 3D libarries for silverlight. I only need HLSL code for changing pixels. I need for my image to look like this Thanks. 回答1: This seems to be the effect you want, you may wish to change the 0.2 value to increase or decrease the effect or make this adjustable in your shader but that's a simple

Selecting the tapped-on word on a single click in textbox

。_饼干妹妹 提交于 2019-12-18 07:10:37
问题 In a Windows Phone 7 app. I happen to have many TextBox s stacked in a ItemsControl and the behaviour across textboxes for selection is not uniform i.e. a single click on any word in any text box does not select the tapped word. First a click is consumed for focusing the text box and then another to actually select the word; but once the text box has focus, it's a single click to select any word within, until the user wants to select some other word in another textbox. Is there a way to

WP7: Why does a ListBox.ItemsPanel break my ElementName data binding?

巧了我就是萌 提交于 2019-12-18 07:03:16
问题 I have a Windows Phone 7 ListBox that binds to a list of integers. I am using the default MVVM Light template, so there is a ViewModel class that contains data and a simple RelayCommand . Here is the ListBox: <ListBox ItemsSource="{Binding MyData}"> <ListBox.ItemTemplate> <DataTemplate> <Button Content="{Binding}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <cmd:EventToCommand Command="{Binding ElementName=ContentGrid, Path=DataContext.TestCommand}" CommandParameter="{Binding

Add a Load More Button at the end of ListBox without losing Virtualization?

僤鯓⒐⒋嵵緔 提交于 2019-12-18 06:55:00
问题 I know by editing the ListBox 's default style like this, I can have a Button at the very end of the ListBox . <ScrollViewer x:Name="ScrollViewer" ...> <StackPanel> <ItemsPresenter /> <Button /> </StackPanel> </ScrollViewer> However, doing this will break the ListBox 's Virtualization and the rendering time becomes really long. All I can think of is, Create a dummy item and add it to the end of my item collection in the viewmodel, and have a Visibility property in the dummy object called

Silverlight PollingDuplex InnerChannel faulted with multipleMessagesPerPoll (serverPollTimeout)

老子叫甜甜 提交于 2019-12-18 06:48:46
问题 Im running silverlight client version 4.0.50917.0 and SDK version 4.0.50826.1 I've created a simple silverlight client against a wcf pollingduplex binding: Web.config: <system.serviceModel> <extensions> <bindingExtensions> <add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </bindingExtensions> </extensions> <behaviors>