Questions tagged [silverlight]
Silverlight is Microsoft's cross-browser, cross platform plug-in for media experiences and rich interactive applications.
silverlight
27,169
questions
414
votes
5
answers
289k
views
Difference between SelectedItem, SelectedValue and SelectedValuePath
What is the difference betweeen the following:
SelectedItem
SelectedValue
SelectedValuePath
All these dependency properties are defined in Selector class. I often confuse SelectedItem with ...
266
votes
35
answers
180k
views
How to automatically select all text on focus in WPF TextBox?
If I call SelectAll from a GotFocus event handler, it doesn't work with the mouse - the selection disappears as soon as mouse is released.
EDIT: People are liking Donnelle's answer, I'll try to ...
215
votes
11
answers
210k
views
How do I space out the child elements of a StackPanel?
Given a StackPanel:
<StackPanel>
<TextBox Height="30">Apple</TextBox>
<TextBox Height="80">Banana</TextBox>
<TextBox Height="120">Cherry</TextBox>
</...
183
votes
8
answers
127k
views
This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread [duplicate]
I have a DataGrid which is populating data from ViewModel by asynchronous method.My DataGrid is :
<DataGrid ItemsSource="{Binding MatchObsCollection}" x:Name="dataGridParent"
...
167
votes
8
answers
9k
views
Getting Started with Windows Phone 7 [closed]
This is a community wiki list of Windows Phone 7 resources. Feel free to edit/add/etc.
When posting, please use the friendly format of
[Actual Name of resource with a link]
not
[some long URL with ...
140
votes
11
answers
149k
views
Could not find an implementation of the query pattern
In my silverlight application I am trying to create a database connection using LINQ.
First I add a new LINQ to SQL class, and drag my table called "tblPersoon" into it.
Then in my service file I try ...
126
votes
4
answers
58k
views
WPF vs Silverlight [duplicate]
Possible Duplicate:
What is the difference between WPF and Silverlight application?
What are the exact differences between WPF and Silverlight?
123
votes
6
answers
271k
views
How to trigger event when a variable's value is changed?
I'm currently creating an application in C# using Visual Studio. I want to create some code so that when a variable has a value of 1 then a certain piece of code is carried out.
I know that I can use ...
93
votes
10
answers
15k
views
TextBox.TextChanged event firing twice on Windows Phone 7 emulator
I have a very simple test app just to play around with Windows Phone 7. I've just added a TextBox and a TextBlock to the standard UI template. The only custom code is the following:
public partial ...
90
votes
11
answers
47k
views
Cannot install silverlight 4 tools on visual studio 2010 sp1
I've installed Visual Studio 2010 (fresh install), then applied the SP1. Now I've tried to install the silverlight 4 tools, but i'm getting a strange error message :
"Visual Studio 2010 or Visual ...
90
votes
4
answers
77k
views
How to create a style based on default style?
How to create a style based on default style in Silverlight?
For example, in WPF we make it like:
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter ...
78
votes
6
answers
123k
views
Format Date/Time in XAML in Silverlight
I have a Silverlight 4 application. I have a C# DateTime object that I'm binding to my UI. I want this DateTime to be in the format of dd/mm/yyyy time (TimeZone). For instance, today would be ...
78
votes
1
answer
73k
views
Bind Collection to StackPanel
I want to take a collection of objects and bind it to a StackPanel so basically if the collection has 4 elements, inside the stack panel that should produce 4 buttons lets say.
I tried this...But I ...
73
votes
29
answers
6k
views
What is so evil about a Flash based website?
I have the feeling that Flash-based ( or Silverlight-based) websites are generally frowned upon, except when you are creating games or multimedia-content rich applications. Why this is so?
70
votes
22
answers
15k
views
Silverlight vs Flex [closed]
My company develops several types of applications. A lot of our business comes from doing multimedia-type apps, typically done in Flash. However, now that side of the house is starting to migrate ...
68
votes
4
answers
123k
views
Encoding parameters for a URL
I have a Silverlight application that is building a URL. This URL is a call to a REST-based service. This service expects a single parameter that represents a location. The location is in the form of "...
64
votes
4
answers
36k
views
Validation Error Style in WPF, similar to Silverlight
By default, the Validation.ErrorTemplate in WPF is just a small red border without any ToolTip.
In Silverlight 4, the validation error is nicely styled out-of-the-box.
Here is a comparison of a ...
64
votes
1
answer
9k
views
What is the difference for TargetType="{x:Type Button}" and TargetType="Button"?
What is the difference for
TargetType="{x:Type Button}"
and
TargetType="Button"
61
votes
5
answers
39k
views
What is an easing function?
What is meant by easing function in the context of animation. It seems that dojo, jquery, silverlight, flex and other UI systems have the notion of easing function. I could not locate a good ...
59
votes
8
answers
125k
views
Set CornerRadius on button template
I want to have a Button that defines no CornerRadius and two others that do, how can I achieve this?
<Style TargetType="Button" x:Key="TabButton">
<Setter Property="Background" Value="...
57
votes
5
answers
31k
views
How to Avoid Firing ObservableCollection.CollectionChanged Multiple Times When Replacing All Elements Or Adding a Collection of Elements
I have ObservableCollection<T> collection, and I want to replace all elements with a new collection of elements, I could do:
collection.Clear();
OR:
collection.ClearItems();
(BTW, what's ...
55
votes
11
answers
45k
views
Can't install Silverlight Developer runtime
I have installed VS 2010 professional with full installation in Windows 7.
I have installed Silverlight 5.0 separately.
When I create silverlight application, it asks for installing silverlight ...
54
votes
8
answers
51k
views
How can I align a CheckBox with its content?
The look of a WPF CheckBox misaligns the check portion with the label (content) portion. The check stays slightly above the content as shown here:
The XAML looks like this:
<CheckBox Content="...
53
votes
8
answers
65k
views
Converter With Multiple Parameters
How does one use a converter with Multiple parameters in a Windows Phone 7 Application?
53
votes
2
answers
95k
views
How to go to particular Item in IEnumerable
I have IEnumerable which contains number Data inside it.
Edit
The IEnumerable is from System.Collection.Ienumerable directive.
Attached the snapShot of Viual Studio, Enum that Contains Data:
alt ...
53
votes
1
answer
12k
views
Make a XAML file internal in .NET
In my Silverlight project, I would like to make an assembly which contains .xaml that can't be seen from outside of the assembly. However, there is no clear way I can do this. When I modify the access ...
53
votes
5
answers
64k
views
Access codebehind variable in XAML
How can I access the public variable which in Sample.xaml.cs file like asp.net <%=VariableName%>?
51
votes
6
answers
62k
views
How to make checkbox bigger
I'm using a checkbox control like this:
<CheckBox VerticalAlignment="Bottom" IsChecked="{Binding Selected}"
Grid.Column="0"
FontSize="{StaticResource PhoneFontSizeLarge}"
...
51
votes
4
answers
98k
views
How do I update a single item in an ObservableCollection class?
How do I update a single item in an ObservableCollection class?
I know how to do an Add. And I know how to search the ObservableCollection one item at a time in a "for" loop (using Count as a ...
51
votes
3
answers
76k
views
How do I raise an event in a usercontrol and catch it in mainpage?
I have a UserControl, and I need to notify the parent page that a button in the UserControl was clicked. How do I raise an event in the UserControl and catch it on the Main page? I tried using static, ...
51
votes
9
answers
34k
views
Hiding inherited members
I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency ...
50
votes
6
answers
55k
views
Silverlight 4: Resolving Microsoft.Silverlight.CSharp.targets was not found?
I've been upgrading some Silverlight 3 apps to Silverlight 4 in Visual Studio 2010. My Silverlight 3 apps open fine in Visual Studio, but SL4 apps don't, with the following error:
C:\Path\To\...
50
votes
17
answers
16k
views
How do you force Firefox to not cache or re-download a Silverlight XAP file?
When working with Silverlight, I've noticed that Firefox will cache the XAP file, so if I do an update, a user may be stuck using an outdated version. Is there a way to force the browser to either re-...
49
votes
8
answers
29k
views
TextBox Binding TwoWay Doesn't Update Until Focus Lost WP7
I have a page with some text boxes for data input. The binding of the text box is set to TwoWay. The data in my view model only gets updated if the text box loses focus. If I click a button, such as ...
49
votes
2
answers
9k
views
WPF/Silverlight - Prism - Resources for beginners
Official Websites
Composite Application Guidance for WPF and Silverlight
patterns & practices: Composite WPF and Silverlight
Articles
Composite Web Apps With Prism
Podcasts
PRISM for ...
48
votes
8
answers
55k
views
Good Silverlight-MVVM Practice Example
I've read a number of good articles about the Model-View-ViewModel pattern and my team intends to implement this pattern in the latest version of our app. I still don't quite get ALL the bits that go ...
47
votes
26
answers
81k
views
Error HRESULT E_FAIL has been returned from a call to a COM component
In Silverlight 4 app; what does this error mean?:
"Error HRESULT E_FAIL has been returned from a call to a COM component."
It's a very generic error. The VS debugger doesn't point to the exact ...
46
votes
10
answers
5k
views
Setting a custom property within a WPF/Silverlight page
This sounds like it should be simple. I have a Page declared in XAML in the normal way (i.e. with "Add new item...") and it has a custom property. I'd like to set that property in the XAML ...
45
votes
5
answers
29k
views
Benefits of MVVM over MVC
Finally getting to do some Silverlight development and I came across MVVM. I am familiar with MVC and the article I was reading said because of XAML, MVC would not work out. Not having too much ...
44
votes
6
answers
163k
views
How to programmatically set the Image source
When the Image's Source property is set the following way, the picture is taken from /Images/down.png.
How would I do the same thing programmatically?
<Image x:Name="myImg" Source="/MyProject;...
43
votes
7
answers
28k
views
Hide tooltip if binding is null
Currently i've got the following code to show a tooltip.
<Border BorderBrush="Black"
BorderThickness="{Binding Border}"
Height="23"
Background="{Binding Color}">
<...
43
votes
3
answers
14k
views
MVVM Light: how to unregister Messenger
I love the MVVM Light's Messenger and its flexibility, however I'm experiencing memory leaks when I forget to explicitly unregister the recipients (in Silverlight 4).
The cause is explained here, but ...
42
votes
2
answers
16k
views
Why dependency properties?
Why did Microsoft go the route of making dependency properties and dependency objects instead of using reflection and maybe attributes?
42
votes
12
answers
22k
views
Should I use the Model-View-ViewModel (MVVM) pattern in Silverlight projects?
One challenge with Silverlight controls is that when properties are bound to code, they're no longer really editable in Blend. For example, if you've got a ListView that's populated from a data feed, ...
42
votes
0
answers
2k
views
How to make a composite manifest for Microsoft smooth streaming
I am new to Microsoft Smooth Streaming and have questions about the making of composite manifests.
Following the guidance from here.
I was able to make a composite manifest of a single clip element ...
41
votes
11
answers
24k
views
Xap packaging failed. Object reference not set to an instance of an object
I'm getting this error message on my PC when I try to build my Windows Phone app:
Xap packaging failed. Object reference not set to an instance of an object
I'm using Dropbox. On my laptop, It works ...
41
votes
5
answers
43k
views
Unknown build error Cannot resolve dependency to System.Windows
I just downloaded PoshConsole's source code and was trying to build the solution. I initially had two problem -
the System.Interactivity.dll could not be resolved. I installed Blend 4 SDK and that ...
40
votes
5
answers
28k
views
Determining the Enter key is pressed in a TextBox
Consider a XAML TextBox in Win Phone 7.
<TextBox x:Name="UserNumber" />
The goal here is that when the user presses the Enter button on the on-screen keyboard, that would kick off some ...
40
votes
1
answer
7k
views
What are these numbers on the right side of my Windows Phone Silverlight app?
I've got a Windows Phone Silverlight app, and there are some numbers to the right when I run the emulator:
What do they mean, and how can I hide them?
39
votes
4
answers
44k
views
Silverlight: stretching to remaining space in StackPanel
I have a vertical StackPanel with two elements: a Button and a ListBox. How can I have the ListBox stretch to the remaining page height?
<StackPanel Height="Auto" Width="Auto">
<Button ...