wpf

WPF Text Formatting in ListView

I need to apply some text formatting when displaying items in a WPF ListView. The text formatting is nothing too fancy just setting the background colour differently on certain strings within the text. The text does not lend itself to different columns so it's not an option to apply a style to one of the ListView columns. I'm pretty ...

WPF: Show UserControl before all bound properties are loaded.

I have one UserControl which has a ListView showing a list of Client objects. Double clicking one of the rows plays an animation and transitions to another UserControl which shows the list of accounts for that client. The second user control is bound to the Accounts property on the Client object. The list of accounts is loaded the firs...

Remove Silverlight Documentation from Visual Studio Help

How do I filter out the Silverlight documentation when I'm developing WPF application in VS2008? It's very annoying to get the help for the Silverlight version of the class when I press F1. I'd prefer not to remove the documentation for Silverlight altogether since I will need it in the future, but some way to choose between WPF and Sil...

How can I mark a form/field as "dirty" if it's databound?

If I have a databound form, how do I know if a user has modified it (either by typing text into a text box, or by selecting an item in a combobox)? I've tried hooking into my textbox's "TextChanged" event, but the problem is that, when my form participates in databinding, the "TextChanged" event fires, prematurely marking my form as "dir...

How can I add an additional item to a WPF ListBox using ItemSource?

I have a WPF form with a ListBox of items bound to a method that gets the items for the list box. What I want is an additional item at the top of the ListBox that behaves differently to the rest of the items. For example, let's say I have a list of Authors (databound to a List), and when I select an author it populates another listbox ...

WPF DataTemplate Run function on button press?

Well the question says it all? I have a DataTemplate with a button is there any way to run a function or some how tell the object that the button was pressed? ...

What is the difference between WPF and Silverlight application ?

What is the difference between WPF and Silverlight application ? Are they the same ? ...

Bring element forward (Z Index) in Silverlight/WPF

All the documentation and examples I'm finding online for setting Z-Index to bring an element forward in Silverlight are using a Canvas element as a container. My items are Border elements inside of an ItemsControl container in a DataTemplate. I'm using the MouseEnter and MouseLeave events to trigger an animation on the ScaleTransform....

What is WinForms' Control.Invoke in WPF?

What do i use instead of Me.Invoke when i use wpf? ...

Forcing WPF to create the items in an ItemsControl

I want to verify that the items in my ListBox are displayed correctly in the UI. I figured one way to do this is to go through all of the children of the ListBox in the visual tree, get their text, and then compare that with what I expect the text to be. The problem with this approach is that internally ListBox uses a VirtualizingStackP...

What is the best way to create toolbar buttons with separate active/disabled images in WPF?

I'm working on the toolbar for a WPF application. The icon set we are using has separate icons for normal, hover and disabled states, and I would like to use them. I was wondering what the simplest solution/normal way of doing this is? My first thought was to create a user control "ImageButton" with properties NormalImage, ActiveImage, ...

WPF EventTriggers - Cannot convert string 'MouseEnter' in attribute 'RoutedEvent' to object of type 'System.Windows.RoutedEvent'

I can't get any event triggers to work. A simplified example of what I'm doing is below - <Window x:Name="win" x:Class="EventTriggers.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <Contro...

What is xmlns in every WPF file?

What is xmlns? What role does it play in an XAML file when we create a WPF project? ...

Differences between ElementName="<Me>" and RelativeSource self?

What are the differences between making a binding self-referential via name versus self-referential via RelativeSource? For example: <!-- Self referential via name --> <Window ... x:Name="This" DataContext="{Binding Path=Data, ElementName=This}" > versus <!-- Self referential via RelativeSource --> <Window ... ...

How can I access the root DataContext in a DataTemplate in WPF?

I have a grid of items which is populated using databinding. In the grid I have a DataTemplate for certain cells. I need to access the DataContext of the root element (the one which is hosting the grid) so that I can access additional bindings to support my datatemplate. So you have: Window Window.DataContext = TheDataSourceWithIte...

WPF Service Control app won't build

I have the following code: XAML code for Window1.xaml and the VB.Net code for Window1.xaml.vb. The error I get is the following: "Cannot create instance of 'Window1' defined in assembly 'ServiceControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in marku...

How to make a text box Visibility=Hidden with a trigger

I seem to be having a hard time today. All I want to do is make a TextBox hidden of visible based on a bool value databound to the Window its hosted in. What I have just won't compile and I don't understand why. Please help. <TextBlock Grid.Column="2" Text="This order will be sent to accounting for approval" Foreground="Red" Vertical...

XAML Expert Questions

I am a small ISV. 2 developers. I have an existing application for windows that we sale. I would like to rewrite the UI using WPF and maybe even create a Silverlight version on the web. I have 20 years experience, and I learn things fast. I am sure I could learn XAML, WPF, and Silverlight. However, I am wondering if I should write the i...

Control property not found in WPF, but present in VB.net WindowsForms

Guys, WPF project is not accepting this property definition when starting a thread. Anybody knows the equivalent of the following in WPF? Control.CheckForIllegalCrossThreadCalls = False Thanks in advance! ...

WPF ComboBox Binding Unchangeable

I am trying to bind a ComboBox to data from an object. The object holds a list that is the allowed states and a string that represents its current value. The problem I'm having is that when the form loads it correctly sets the value of the combobox to its current value but I am unable to change the value to anything else. If I click t...