silverlight-4.0

MVVM Light - using ViewModelLocator - properties hit multiple times

怎甘沉沦 提交于 2019-12-25 11:55:01
问题 I'm making use of the MVVM Light ViewModelLocator. I have a class called GlobalViewModelLocator which is hooked up in the resources in the App.Xaml. This class has a static property called Main which returns an instance of the MainViewModel. Then in the MainView.Xaml, I set the datacontext of the usercontrol to bind to the path of this MainViewModel. This works fine - I put a breakpoint on the MainViewModel constructor and it is being hit once. However, all the properties in the ViewModel

Profiling Silverlight 4

牧云@^-^@ 提交于 2019-12-25 09:42:32
问题 I have a Silverlight page that displays100+ user controls in a ScrollViewer (around 50% of the controls are visible at once, depending on browser resolution). When I scroll using the ScrollViewer, scrolling is sluggish and one of my 4 CPU cores goes to 100% (and stays there as long as I keep moving a scrollbar). I wanted to profile the application to better understand where the time is being spent following the instructions on this MSDN Blog. Like one of the commenters, I get the error No

Silverlight run DispatchTimer only once

痴心易碎 提交于 2019-12-25 08:58:06
问题 I'm trying to figure out a way in Silverlight / C# to make a DispatchTimer run only once. I have a user form and when submitted I want to display a message for 10 seconds and then disappear and kill the DispatchTimer thread. I know how to make a DispatchTimer that repeats: clock.Interval = TimeSpan.FromSeconds(10); clock.Tick += clockTick; clock.Start(); But I want that thread to end as soon as it completes. 回答1: This should work for you: DispatcherTimer clock = new DispatcherTimer(); clock

Auto sizing Silverlight controls

我的梦境 提交于 2019-12-25 08:45:05
问题 I am using Silverlight 4 for a project. I want to know if there is a way I can get the main canvas to stretch to the height and width of the browser window it is hosted in? I want the controls within to resize in proportion to the main control that hosts all the rest of the controls in the host browser window. This is a Prism application which has a Shell.xaml and a ContentControl within the shell. In this prism case I want the content control to span to 100% of the screen height and width..

Manually set Validation error on Silverlight control

这一生的挚爱 提交于 2019-12-25 08:39:42
问题 I have a ComboBox which I cannot bind directly to (due to this bug), so I set it's SelectedItem from a Behavior I've written. Now, if the property bound to my behavior's SelectedValue (instead of the ComboBox's SelectedValue) is invalid (e.g. nothing is selected in the comboBox, when there should be), I want to notify the ComboBox to "go red", and display an errorcode. I know this is something the Binding system (if NotifyOnValidationError=true) handles automatically (it sets the bound

Estimate position and Width/Height of rendered UserControl

亡梦爱人 提交于 2019-12-25 07:48:43
问题 I have a UserControl (boxes) that can have varying size based on the number of items in its ItemsControl . Many such usercontrols are added to a Canvas programmatically. I need to draw arrows interconnecting these usercontrols. What is the best way to get the origin coordinates of the control w.r.t the Canvas and the rendered Width / Height so that I can figure out the arrow start and endpoints. 回答1: Canvas provides the coordinates of each control via Canvas.Left and Canvas.Top attached

Silverlight: Use of a local WCF service for business logic (intermediate WCF Service)? (Ria services in conjunction with a normal WCF Service?)

我的梦境 提交于 2019-12-25 04:48:11
问题 I have my silverlight calling my WCF service and its working great. This is a WCF (not ria) service that basically returns enitites or collection of entities. I really don't have control over it to add additional items just for silverlight for example. So i was thinking but maybe its bad performance or desgin.. But to have a local WCF Service hosted with the Asp.net website that hosts silverlight.. ANd i can use this wcf service for business logic that doesn't need to return entities. For

How do you enable sorting on a Silverlight DataGrid that has grouping?

Deadly 提交于 2019-12-25 04:42:52
问题 I can't seem to find a way to specify that it sorts on the group name first, then the column. I am using the DataGrid. EDIT: My mistake, I am using the DataGrid, not the Grid. 回答1: A Grid is not a data control (like a DataGrid) so other than manually sorting and then adding the other items one-by-one, there's really no clean way to do it. You need to think of a Grid as a XAML version of an HTML Table tag. EDIT (OP changed from Grid to DataGrid, adding the following): Support for sorting the

Callback not binding correctly

↘锁芯ラ 提交于 2019-12-25 03:53:52
问题 In the code below, the UnitOccupierDetails collection binds correctly but the OwnersCountString doesn't. Can anyone explain why? This code is in my ViewModel: private void BindSelectedStructure(object param) { UnitOccupierDetails.Clear(); Structure selectedStructure = (Structure)param; this.SelectedStructure = selectedStructure; int StructureID = selectedStructure.IDStructure; loadOwners = context.Load<UserOccupier>(context.GetUnitOccupierDetailsQuery(StructureID), OwnersLoadedCallback, false

Silverlight Web Part not loading until user clicks on page

泄露秘密 提交于 2019-12-25 03:45:12
问题 I am maintaining a Silverlight 4 application that runs as Web Part in SharePoint. However, I have an issue with loading it in Internet Explorer (versions 10 & 11). The user must click on the web page or hit tab for the Silverlight web part to actually load. However, this is not an issue in Chrome. There is a silverlight.js script runs when the page initially loads, but it appears (in Fiddler) that the XAP isn't getting called until the user clicks or or hits tabs on the page. So far, I have