silverlight

Scroll to bottom of listbox wp7

ⅰ亾dé卋堺 提交于 2020-01-06 03:06:26
问题 I have a listbox with more than 20 items. How I can scroll to bottom of it? I tried the ScrollIntoView method, but no success: listmy.SelectedIndex = listmy.Items.Count;// listmy.Items.Count - 1; listmy.ScrollIntoView(listmy.SelectedIndex); listmy.UpdateLayout(); 回答1: The ScrollIntoView method expects an object (the item to scroll to), but you are passing in the numeric index of the selected item. This will work: void MainPage_Loaded(object sender, RoutedEventArgs e) { listmy.SelectedIndex =

Scroll to bottom of listbox wp7

孤人 提交于 2020-01-06 03:06:15
问题 I have a listbox with more than 20 items. How I can scroll to bottom of it? I tried the ScrollIntoView method, but no success: listmy.SelectedIndex = listmy.Items.Count;// listmy.Items.Count - 1; listmy.ScrollIntoView(listmy.SelectedIndex); listmy.UpdateLayout(); 回答1: The ScrollIntoView method expects an object (the item to scroll to), but you are passing in the numeric index of the selected item. This will work: void MainPage_Loaded(object sender, RoutedEventArgs e) { listmy.SelectedIndex =

How to deal with the new line character in the Silverlight TextBox

为君一笑 提交于 2020-01-06 02:26:06
问题 When using a multi-line TextBox (AcceptsReturn="True") in Silverlight, line feeds are recorded as \r rather than \r\n. This is causing problems when the data is persisted and later exported to another format to be read by a Windows application. I was thinking of using a regular expression to replace any single \r characters with a \r\n, but I suck at regex's and couldn't get it to work. Because there may be a mixture of line endings just blindy replacing all \r with \r\n doesn't cut it. So

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

╄→гoц情女王★ 提交于 2020-01-06 01:52:07
问题 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 control with a new FrameworkElement? I realise the Control.Template property is writeable, but I'd prefer to find a way to replace a specific part of that

convert xdocument to IEnumerable<Dictionary<string, object>>

我怕爱的太早我们不能终老 提交于 2020-01-06 01:45:13
问题 I am faced with a problem in my service, one Dataset will fill and convert into a serialized XML object: string xmlString; System.Xml.Serialization.XmlSerializer oSerializer = new System.Xml.Serialization.XmlSerializer(typeof(DataSet)); DataSet ds = new DataSet(); StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) { oSerializer.Serialize(sw, ds); xmlString = sb.ToString(); } This code return me a DataSet: <?xml version="1.0" encoding="utf-16"?> <DataSet>

Custom UserNamePasswordValidator with Silverlight 3.0

杀马特。学长 韩版系。学妹 提交于 2020-01-05 13:09:25
问题 I have implemented a WCF service that uses a TransportWithMessageCredential binding and a custom UserNamePasswordValidator. I have a Silverlight 3 client connecting to this service. If I set valid credentials it works perfect, however, in the username validator I throw a SecurityTokenException if the username and password does not match. Now I have implemented a dummy service call just to verify the credentials, is there a "nicer" way of checking the credentials. A service method that accept

using IsolatedStorageFile with Silverlight 4

淺唱寂寞╮ 提交于 2020-01-05 12:13:54
问题 I am looking at writing a silverlight app that I plan to use OOB setting to enable use on both PC and mac. I have been doing a little investagation on the isolationstoragefile and what I understand is it will work for both pc and mac without a problem.....Is that correct? The application I am building is going to be a business application that will submit details back to the main database if there is an available connection. If not then I want to store the information locally until there is

using IsolatedStorageFile with Silverlight 4

£可爱£侵袭症+ 提交于 2020-01-05 12:13:30
问题 I am looking at writing a silverlight app that I plan to use OOB setting to enable use on both PC and mac. I have been doing a little investagation on the isolationstoragefile and what I understand is it will work for both pc and mac without a problem.....Is that correct? The application I am building is going to be a business application that will submit details back to the main database if there is an available connection. If not then I want to store the information locally until there is

Is there any way to instantiate a 'Type' in Silverlight XAML?

。_饼干妹妹 提交于 2020-01-05 10:10:13
问题 It's well known that Silverlight lacks the very compelling x:Type MarkupExtension (MarkupExtension is not supported in Silverlight at all). Is there any dynamic workaround for it? What about enums (x:Static)? My need is to have a CommandParameter set to a Type or Enum value, neither of these are supported in Silverlight! 回答1: This generally has to be done in the code-behind. Even if you build a custom object that exposes a property of type Type, it will not get properly "converted" when set

Show child window before InitializeComponent

眉间皱痕 提交于 2020-01-05 08:42:59
问题 I have Silverlight application i want to show login window before main page InitializeComponent(); this method does not works: public MainPage() { Login log = new Login(); log.Show(); InitializeComponent(); } Any advice? 回答1: Try this: public MainPage() { InitializeComponent(); Loaded += MainPage_Loaded; } private void MainPage_Loaded(object sender, RoutedEventArgs e) { Visibility = Visibility.Collapsed; Login log = new Login(); log.Show(); } 来源: https://stackoverflow.com/questions/8526230