silverlight-4.0

Silverlight 4 wait/spinner control

回眸只為那壹抹淺笑 提交于 2020-01-06 17:58:32
问题 I'd like to implement a spinner control (something along these lines) in Silverlight 4 to display during pending operations. There are several examples on the web for Silverlight 3 but I'm either unable to compile them into my project or they just flat out display nothing. In addition I'm unable to find any examples specific to Silverlight 4. Can someone please post a sample for Silverlight 4 or a link to one? 回答1: You can use the BusyIndicator. How To Work With Silverlight BusyIndicator?

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>

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

display list of items horizontally in Silverlight 4

北城余情 提交于 2020-01-05 06:09:30
问题 I want to display a list of products horizontally in silverlight 4 page . The list of products will be obtained dynamically. Foreach product i show i need to dispaly the product image,name and its price. Please let me know if anyone had thougts on this. 回答1: Use ListBox. Then use it's ItemsPanel property to specify StackPanel with Orientation=Horizontal. Then you specify how each product should be shown by using ItemTemplate. You didn't specify how exactly you want to arrange your product and

Hit testing child controls added to a canvas does not work

半城伤御伤魂 提交于 2020-01-05 03:11:26
问题 I am trying to do hit testing on a collection of user controls added to a canvas at runtime. My canvas: <Canvas x:Name="LayoutRoot" Background="White"> <Canvas x:Name="Carrier" Canvas.ZIndex="-1"> </Canvas> </Canvas> My canvas code: public MainPage() { InitializeComponent(); var uiElement = new MyUserControl(); this.Carrier.Children.Add(uiElement); MouseLeftButtonDown += MouseLeftButtonDownHandler; } private List<UIElement> HitSprite(Point p) { var hitElements = VisualTreeHelper

Sl 4, MVVM: Using Inlines in a TextBlock, how to bind to the ViewModel?

主宰稳场 提交于 2020-01-05 03:07:29
问题 We format text for a TextBlock by adding a series of System.Windows.Documents.Run objects to TextBlock.Inlines. How can we bind the formatted text in the ViewModel to display in the TextBlock? Thanks for any advice... 回答1: I attempted creating an InlineCollection property in aViewModel, then set the binding in the xaml, but the InlineCollection in TextBlock is not bindable, since it is not a DependencyProperty. The answer to this question shows creating your own control and making it a

Problem with conversion of existing project to Silverlight 4

半腔热情 提交于 2020-01-04 09:38:50
问题 We have a working Silverlight 3 project. After changing the target framework to Silverlight 4 the application won't start anymore. It throws an exception in the following line in the generated InitializeComponent() method: System.Windows.Application.LoadComponent(this, new System.Uri("/SLAppMain;component/App.xaml", System.UriKind.Relative)); Here is the exception (note the inner exception): System.Windows.Markup.XamlParseException occurred Message= [Line: 0 Position: 0] LineNumber=0

Could not load file or assembly > 'System.Windows, Version=2.0.5.0

会有一股神秘感。 提交于 2020-01-03 15:33:27
问题 On first load of my Silverlight application I keep getting this error: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified but by just refreshing the page, it'll be solved! it seems that it's known bug of Silverlight : http://connect.microsoft.com/VisualStudio/feedback/details/464190/silverlight-compilation-problem-in-team-build-environment they suggest

Capture print dialog's cancel in silverlight printing

爷,独闯天下 提交于 2020-01-03 10:44:54
问题 Does anyone know if you can find out if the print dialog's cancel was clicked? I've seen post and doc that say "EndPrint – Event fired when the printing is either completed or canceled. " But I don't think that is the print dialog's canceled... I think the is if the print job is canceled. thanks 回答1: Based on the documentation, I don't believe there's an easy way: http://msdn.microsoft.com/en-us/library/system.windows.printing.printdocument.endprint(v=VS.95).aspx In particular: The EndPrint

Binding to another viewmodel

扶醉桌前 提交于 2020-01-03 06:02:46
问题 I am trying to bind a visibility property to a function I made in a viewmodel ( MainViewModel ), but I am getting this error: A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll System.Windows.Data Error: BindingExpression path error: 'Main' property not found on 'Locator' 'System.String' (HashCode=-191326816). BindingExpression: Path='Main.TilesHomeViewVisible' DataItem='Locator' (HashCode=-191326816); target element is 'myApp.Views.TilesHomeView'