silverlight-4.0

Can I use Silverlight's WriteableBitmap to save non-visible parts of my UI to a bitmap?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 10:09:36
问题 Say I have some grid that you need to scroll down to see all of its lines, and I'm interested in saving some lines that are not currently visible as a bitmap. Is it feasible, or do I have to actually scroll down, "take a snapshot", and then scroll up again? This is a feasibility question, and thus I don't have code to share. 回答1: Yes. You can render any UIElement (and its children) to a writeable bitmap. When you do that you also specify a transform. That means you can display any part of the

How do I truncate a string with an ellipsis in a Silverlight TextBlock?

£可爱£侵袭症+ 提交于 2019-12-23 07:56:14
问题 If I display a string too long for a TextBlock it just appears to keep writing past the edge of the TextBlock. I'd rather it use the common technique of adding an ellipsis ("...") if the text is not going to fit in the space provided. How should I go about doing this in Silverlight? The references I've found all use the TextRenderer class which is not available in Silverlight 回答1: You didn't say which Silverlight version this is. Assuming Silverlight 4, it's baked into TextBlock via the

How to bind to a singleton property in Silverlight 4?

谁都会走 提交于 2019-12-23 07:38:46
问题 Hi all first post here :) Let's start with a snippet of the code I'm using: public MyClass : INotifyPropertyChanged { private static MyClass _instance; public static MyClass Instance { get { if (_instance == null) _instance = new MyClass(); return _instance; } } private bool _myProperty; public bool MyProperty { get { return _myProperty; } set { if (_myProperty!= value) { _myProperty= value; NotifyPropertyChanged("MyProperty"); } } } private MyClass() { ... } } As you can see, it's a

“The tag 'MenuItem' does not exist in XML namespace 'clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit'” error

♀尐吖头ヾ 提交于 2019-12-23 07:26:34
问题 I'm getting an error trying to build a Silverlight application on a new machine. (Silverlight 4, Visual Studio 2010) This application compiles without error on four other machines. The error is: the tag 'MenuItem' does not exist in XML namespace 'clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit'. The references appear to be pointer to the correct assemblies. Has anyone else ever had this problem? 回答1: Another reason this issue may occur is due to missing a

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 Image Panning

别等时光非礼了梦想. 提交于 2019-12-23 06:36:07
问题 I am working on silverlight application and I want to panning image like top, bottom, left, right how I can panning the image. I had use the pixel shadering but I am not success of this. thanks.. 回答1: Have a look at this sample You could also look at the Blend behavior for dragging. 回答2: This worked for me. User can preview an enlarged image using this window, and pan the image to the sections that is more relevant, e.g. the bottom part of the image. To use the window: BitmapImage BMP = /*

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

Not able to connect to webservice from a WP7 emulator

£可爱£侵袭症+ 提交于 2019-12-23 05:12:39
问题 private void button2_Click(object sender, RoutedEventArgs e) { WebClient wb = new WebClient(); wb.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wb_DownloadStringCompleted); wb.DownloadStringAsync(new Uri("http://weather.yahooapis.com/forecastrss?w=2502265")); } void wb_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { XElement xmlResult = XElement.Parse(e.Result); } This is code i have used. I am getting an error "Unable to connect to the remote

ReactiveUI and Validation

不羁岁月 提交于 2019-12-23 03:11:13
问题 What's considered "best practice" when performing data validation while using ReactiveUI ? Let's say I have a view model that looks like this: public class MyViewModel: ReactiveObject { public ReactiveAsyncCommand SaveMyDataCommand { get; protected set; } private string _email; public string Email { get { return _email; } set { _email = value; raisePropertyChanged("Email"); } } private string _name; public string Name { get { return _name; } set { _name= value; raisePropertyChanged("Name"); }