silverlight

What happened to .ToShortDateString in .NET Portable Class Library

落爺英雄遲暮 提交于 2019-12-23 07:26:34
问题 I am wondering why there is no .ToShortDateString in the .NET Portable Class Library. I have 2 projects (Silverlight, and regular .NET Class Library) that use the same code, and the code involves calling .ToShortDateString() on a DateTime object. In order to reuse the same code instead of copying it in 2 places, I created a portable class library so it can be imported by both Silverlight and .NET Class Library. Unfortunately, it doesn't seem like .ToShortDateString() is available when using

How to get accordion region to expand (vertically) to dynamic content?

无人久伴 提交于 2019-12-23 07:20:07
问题 I have a main datagrid, then an accordion control below it. In one of the accordion items I have another datagrid that binds to the selected item of the first datagrid. Simple xaml is: <sdk:DataGrid Name="dgMain" ItemsSource="{Binding SomeSource}" /> <toolkit:Accordion> <toolkit:AccordionItem Header="Details"> <sdk:DataGrid ItemsSource="{Binding ElementName=dgMain, Path=SelectedItem.Children}"/> </toolkit:AccordionItem> </toolkit:Accordion> I have VerticalAlignment property of the second grid

Silverlight Vertical only ScrollViewer?

无人久伴 提交于 2019-12-23 07:19:28
问题 Is there a way to create a ScrollViewer which only allows content to scroll vertically? The horizontal (width) must be constrained in the same manner as a StackPanel's width is constrained to its parent (when HorizontalAlignment=Stretch). I have a resizable window which contains content I want to allow to scroll vertically. The window contains a ScrollViewer. Inside there is a lot of TextBoxs (a data entry form). When I type lots of text in a TextBox, the control just keeps growing to the

Silverlight 4 RelativeSource FindAncestor binding [closed]

拥有回忆 提交于 2019-12-23 07:19:04
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Will there be RelativeSource FindAncestor, AncestorType... in Silverlight 4? 回答1: In Silverlight 4 the RelativeSource property of Binding still only supports "Self" and "TemplatedParent", there is no change from

How to get a DependencyProperty by name in Silverlight?

我的未来我决定 提交于 2019-12-23 07:09:47
问题 Situation: I have a string that represents the name of a DependencyProperty of a TextBox in Silverlight. For example: "TextProperty". I need to get a reference to the actual TextProperty of the TextBox, which is a DependencyProperty. Question: how do I get a reference to a DependencyProperty (in C#) if all I got is the name of the property? Things like DependencyPropertyDescriptor are not available in Silverlight. It seems I have to resort to reflection to get the reference. Any suggestions?

Is there a way to serialize multiple XElements onto the same line?

放肆的年华 提交于 2019-12-23 07:04:30
问题 I'm dealing with the dreaded <Run/> in Silverlight 3 and having to programmatically create a <TextBlock> and its inlines: Why dreaded? Because it doesn't work, I guess, the way you'd expect. Exhibit A, below, should produce BARN (with fancy colors for each character), but instead it produces: B A R N EXHIBIT A <TextBlock FontFamily="Comic Sans MS" FontSize="88"> <Run Foreground="#A200FF">B</Run> <Run Foreground="#FF0000">A</Run> <Run Foreground="#FFC000">R</Run> <Run Foreground="#FFFF00">N<

Is there a way to serialize multiple XElements onto the same line?

徘徊边缘 提交于 2019-12-23 07:04:29
问题 I'm dealing with the dreaded <Run/> in Silverlight 3 and having to programmatically create a <TextBlock> and its inlines: Why dreaded? Because it doesn't work, I guess, the way you'd expect. Exhibit A, below, should produce BARN (with fancy colors for each character), but instead it produces: B A R N EXHIBIT A <TextBlock FontFamily="Comic Sans MS" FontSize="88"> <Run Foreground="#A200FF">B</Run> <Run Foreground="#FF0000">A</Run> <Run Foreground="#FFC000">R</Run> <Run Foreground="#FFFF00">N<

Closing a Out of Browser application in silverlight from the code

烈酒焚心 提交于 2019-12-23 06:21:57
问题 How do I close an out of the browser application in silverlight programatically. I want to bring in the same functionality as the control box close, from the code based on some condition. How do I acheive it? 回答1: As simple as that :) App.Current.MainWindow.Close(); 来源: https://stackoverflow.com/questions/8036464/closing-a-out-of-browser-application-in-silverlight-from-the-code

DownloadStringAsync requires UI thread? [duplicate]

我的梦境 提交于 2019-12-23 06:18:28
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Execute a WebRequest in a Background thread while UI Thread is blocked Check out this code: Thread t = new Thread((a) => { var client = new WebClient(); client.DownloadStringAsync(new Uri("http://www.google.com")); bool pointB = true; }); t.Start(); t.Join(10000); When this is run on the UI thread in Silverlight, even though DownloadStringAsync() is called quickly, pointB will not be reached until after the Join

DownloadStringAsync requires UI thread? [duplicate]

大憨熊 提交于 2019-12-23 06:18:11
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Execute a WebRequest in a Background thread while UI Thread is blocked Check out this code: Thread t = new Thread((a) => { var client = new WebClient(); client.DownloadStringAsync(new Uri("http://www.google.com")); bool pointB = true; }); t.Start(); t.Join(10000); When this is run on the UI thread in Silverlight, even though DownloadStringAsync() is called quickly, pointB will not be reached until after the Join