silverlight

Reference to a TextBox inside a DataTemplate

我只是一个虾纸丫 提交于 2019-12-20 05:09:09
问题 How do I get a reference to a TextBox that's only defined inside a DataTemplate (assuming that I've just applied this DataTemplate to some cell in a grid). So far I'm using the sender in the TextBox events to retrieve this. Thanks, rui 回答1: For getting the reference of a control inside a Data Template, handling the event and then using the sender is one of the available option. There is one more option that you can try: in .xaml: <toolkit:DataGrid Name="datagrid" Margin="0,0,0,28"

'windows-1255' is not a supported encoding name

孤街醉人 提交于 2019-12-20 05:01:25
问题 I'm writing a silverlight 5 application in which I need to read a text file from the user. Here is a snippet of my code: using (StreamReader reader = new StreamReader(fileStream, Encoding.GetEncoding("windows-1255"))) But I get the exception: "'windows-1255' is not a supported encoding name". Why is that? And then, how do I read a file in the "windows-1255" encoding? (Hebrew) 回答1: There are not many supported encodings in Silverlight. Basically, you get UTF8 and UTF16, see http://msdn

'windows-1255' is not a supported encoding name

試著忘記壹切 提交于 2019-12-20 05:01:10
问题 I'm writing a silverlight 5 application in which I need to read a text file from the user. Here is a snippet of my code: using (StreamReader reader = new StreamReader(fileStream, Encoding.GetEncoding("windows-1255"))) But I get the exception: "'windows-1255' is not a supported encoding name". Why is that? And then, how do I read a file in the "windows-1255" encoding? (Hebrew) 回答1: There are not many supported encodings in Silverlight. Basically, you get UTF8 and UTF16, see http://msdn

Windows Phone Image Binding

扶醉桌前 提交于 2019-12-20 04:58:16
问题 I want to put images in my ListBox using Binding. Below is the object containing the URI's: _roomView.Room = new Room { Items = new List<Item> { new Item {ItemType = ItemType.BlueKey, ImageUri = "/Escape;component/Images/Items/a.jpg"}, new Item {ItemType = ItemType.Bracelet, ImageUri = "/Escape;component/Images/Items/b.png"}, new Item {ItemType = ItemType.Money, ImageUri = "/Escape;component/Images/Items/b.png"}} }; DataContext = _roomView; Below is the XML: <ListBox x:Name="Mylist"> <ListBox

Saving image to database as varbinary (silverlight)

淺唱寂寞╮ 提交于 2019-12-20 04:57:15
问题 Today I have been trying to get an image to save into a database, and I really can't figure it out. I have made the following table ( Afbeeldingen ): id:int afbeelding1:varbinary(max) Imported it with a Linq-to-SQL class, wrote a WCF service for it: [OperationContract] public void setAfbeelding(Afbeelding a) { dc.Afbeeldings.InsertOnSubmit(a); dc.SubmitChanges(); } And then in my xaml page I try to to create an Afbeelding , but I can't put the Byte[] as a varbinary . I don't know how to do

Silverlight tabchanged event - tabcontrol

ぐ巨炮叔叔 提交于 2019-12-20 04:52:30
问题 I'm using tab control and I want to handle tabchanged event. I was trying to use SelectionChanged event with no luck. It's being fired too many times (after loading tabcontrol, or adding new tab). I would like to handle this event only when user navigates between tabs. I have found solution for WPF (Is there Selected Tab Changed Event in the standard WPF Tab Control) but it's no good for Silverlight. TIA. 回答1: Firing "too many times" should not be a problem if you check for an actual change

Is it never possible to get the FullName from a file using Silverlight OpenFileDialog?

为君一笑 提交于 2019-12-20 04:27:15
问题 I want to get the fullname from a file on Silverlight OpenFileDialog, when I try that, Silverlight throws me an error. I saw there is an attribute on FullName saying it is [SECURITY CRITICAL], but I need to display the full path, is it really no way I can do that? 回答1: OpenFileDialog won't provide the full name simply because it doesn't want you to alter those files. With Silverlight, you only have access to the isolated storage and the file could be located outside this storage. But you

How to crop image on ScheduledTaskAgent in Windows Phone

血红的双手。 提交于 2019-12-20 04:24:07
问题 I need to crop an image using a ScheduledTaskAgent. Since it runs in the background I get a cross-thread exception when trying to instantiate a WriteableBitmap (as it needs to be created in the UI thread). I have a stream of the image, how would I go about cropping it without using a WriteableBitmap? Thanks 回答1: You can use the dispatcher (and therefore the UI thread) even in a background agent: protected override void OnInvoke(ScheduledTask task) { Deployment.Current.Dispatcher.BeginInvoke((

Databinding the color of a RadialGradient brush in silverlight 3

二次信任 提交于 2019-12-20 04:23:11
问题 I am trying to databind the color of a RadialGradientBrush in silverlight 3 to a property, but just can't seem to get it to work. For example, in a sample test app all I have is <navigation:Page x:Class="SilverlightNavigator.HomePage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Name="HomePageUC" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" Title="HomePage Page

Constructor cannot call itself c#

空扰寡人 提交于 2019-12-20 03:57:08
问题 Constructor "Delay.vkMessages.vkMessages(string, System.DateTime, string, bool, string)" cannot call itself.I have another class, copy of this class, but it works(I can add code).How I can resolve this error? using System; using System.Collections.Generic; using System.ComponentModel; using ImageCacher; namespace Delay { public class vkMessages : INotifyPropertyChanged { public string Kto { get; private set; } public DateTime Date_Time { get; private set; } public string InOrOut { get;