wpf

What is this method of element instantiation called?

Whenever I create a UIElement in code behind, I'd do something like this: Button button = new Button(); button.Content = "Click Me!"; But then I saw this syntax somewhere, and wanted to know what it's called. I haven't ever seen it used in any of my .NET books: Button button = new Button { Content="Click Me!" }; This is obviously ...

How can I use a Panel as a Region in Prism?

The prism documentation states that there are three region adapters available: ContentControlRegionAdapter. This adapter adapts controls of type System.Windows.Controls.ContentControl and derived classes. SelectorRegionAdapter. This adapter adapts controls derived from the class System.Windows.Controls.Primitives.Selector, such ...

SortDescriptions

Hi all, I'm using c# in combination of WPF. I've used an CollectionView with a single SortDescription. But in certain cases the SortDescription is not used. Yet I couldn't find out why this is happening. The combobox isn't sorted for some reason. When I add a second sortdescription with the same sorting option it also happens. No cv....

How to Catch Exceptions in WPF when Calling a WCF Sevive

How to Catch Exceptions in WPF when Calling a WCF Sevive ...

Wpf UI Control that mimicks iphone vertical menu?

Hi community, I'm wondering if there is a Wpf control or example that mimics the iphone navigation in its vertical menu. (ex. http://davidcann.com/iphone/). The part that actually interests me is the horizontal scrolling of a new menu once an option is selected in the parent menu. I'm open for suggestions. ...

WPF Launchy Clone (Focus problem)

I have a WPF application that has some functionality that is very closely related to Launchy - i.e., someone presses Ctrl+Space and they receive a search bar. This functionality should be available throughout the system, and I have used the ManagedAPI.Hotkey code to make this work - and it does. The problem is that when the search wind...

How to cast a System.Windows.Controls.SelectedItemCollection?

I have a method private void DeletePuzzle(object param) { } param is a System.Windows.Controls.SelectedItemCollection, that I got from a WPF ListViews SelectedItems property. Somehow, I can't seem to cast it from an object to anything useful. I can't create a System.Windows.Controls.SelectedItemCollection because of it's protectio...

How can I change an elements style at runtime?

I have an element and multiple styles, how do I switch between the styles at runtime either programatically or through XAML binding. <Rectangle x:Name="fixtureControl" Style="{DynamicResource FixtureStyle_Fast}"> <!-- In the style resources. --> <Style x:Key="FixtureStyle_Fast" TargetType="{x:Type Shape}"> <Setter Property="Stroke"...

How do I cache images on the client for a WPF application?

We are developing a WPF desktop application that is displaying images that are currently being fetched over HTTP. The images are already optimised for quality/size but there is an obvious wait each time that the image is fetched. Is there a way to cache images on the client so that they aren't downloaded each time? ...

Show tree 'lines' in WPF

Hi, I have a treeView in WPF in which I have several level. When I expands the level, I would like to display dotted lines from the parent to the leaves so that it's more visual. However, it doesn't to be like that by default. Is it possible, and if yes, how? Thanks you. ...

How to play MPEG-TS (transport stream) from WPF and Silverlight

I've tried MediaElement with a .ts file - its not interested (HRESULT: 0xC00D11B1). The TS file plays with WMP no problems (Cannot seem to play it in graphedt though?) I thought MediaElement was supposed to support what WMP supported? Update: This is on Windows 7 by the way (apparently it has a slightly different media stack if that m...

Strategy to diagnose Expression Blend 2 failure to open Window

I have a project with many WPF Windows. 1 particular Window doesn't open in Expression Blend 2. I would like to know what strategies i can use to diagnose and avoid the problem in future. Most of the time, Blend 2 will display a window with an exception. I would then fix the problem causing that exception. However, this time, this is t...

ListBox with DoubleClick on Items using DataTemplate

Hello, i want to know a double-clicking functionality for a list-box kann easily be build. I have a list-box with a collection as ItemSource. The collection contains own data-types. <ListBox ItemsSource="{Binding Path=Templates}" ItemTemplate="{StaticResource fileTemplate}"> I defined a data-template for my Items, which con...

How to implement filtering for BindingList and ICollectionView

Hi, I'm currently using a BindingList that is bound to a WPF-ItemsControl. As I need to implement some filtering on that list, I would like to take advantage of the filtering possibilities of ICollectionView. Unfortunately the straight-forward approach, returns false for CanFilter and CanCustomFilter. So I'm wondering what is the corre...

What are the basic rules for designing class structure to map relational database?

A WPF application should be a visualizer front-end for a ERP database (in fact only small part of it). They are connected trough web services. What are main rules for designing a data model class structure for mapping database tables? For example, should it be a one big flat class with lots of members, or lots of classes representing di...

Change the FocusVisualStyle in the entire application

While making a WPF application I would like to change the default FocusVisualStyle (the black "marching ants" border) to something else, like for example a blue border. I would like to make this change for every control on the entire application. Is there an easier way then changing the default style for every type of control? Thanks ...

DevExpress WPF Grid - Event when columns width is changed...

Hello, does anyone knows, which event is raised, when user changes width of column for WPF DevExpress grid? I want to use it to store columns widths in database. ...

It's possible to expose new events/properties in a WPF templated control?

Maybe the obvious answer is that I need to use a UserControl but I'd like to know if this is possible. I want to customize a ComboBox to display an additional button. I've been able to create a template that renders the button next to the built-in drop down button. Now, how can I wire the Click event or access any of its properties (for...

WPF Custom Validation MVVM

Hi everyone. I'm having problems coming up with a good way to validate user input. I'm aware that I can implement IDataErrorInfo to do simple validation on user input, and I have read several articles on the subject (such as this and this) without seeing the light. Let me explain the two problems I have: Basically I'm implementing an ap...

BorderThickness of 1 renders with a 2-pixel thickness - what am I missing here?

I've got a Border in XAML/WPF that I'm using to give a full-paragraph-width underline to text headings in a dialog. I set its BorderThickness property to "0,0,0,1". In some places, it ends up being rendered with a 2-pixel thick underline while in others it appears correctly as a single-pixel underline. What am I doing wrong? Here's the ...