wpf

WPF/XAML: Is there a way to use x:static with a function?

This is my XAML: ItemsSource="{x:Static app:HealthCheckSystemCategoryLookup.All} Is there a way to make HealthCheckSystemCategoryLookup.All a function instead of a property? ...

Line breaks and indenting for the XAML of a saved FlowDocument?

Is there a way to format the XAML that is generated when a FlowDocument is saved? Currently, it is all run together on one line, and I'd like to break it up into its elements, with line breaks and indenting, to make it a little easier to read. Here is the code I am using to save a FlowDocument from a WPF RichTextBox as a XAML file: // ...

Set list items to grow to the width of the containing ListView - WPF

I would like the items of my ListView to grow to take up the entire width of the avaliable space within the ListView. Currently, I have the item's width set like this (the ListView is named listView): Width="{Binding ActualWidth, ElementName=listView, Mode=OneWay}" The items will take up the width of the ListView. However, the vertic...

Specifying the Tension in a Cubic Bezier Curve

I am attempting to create a PathGeometry that approximates a series of orthogonal line segments using cubic bezier curves in Wpf. I came across an article on msdn that describes Cardinal Splines in GDI+, which is almost exactly what I wish to accomplish. I have, for the most part succeeded, but I now need to implement a property which c...

WPF: Command bindings for Buttons in datagrids

In this sample I have two buttons. The button in the header works, but the one in the grid gives me the error show below. <GroupBox DockPanel.Dock="Top" > <GroupBox.Header> <StackPanel Orientation="Horizontal"> <Label Content="Recent Servers" /> <CheckBox Content="Auto-Refresh" /> <Button ...

wpf textbox focus issue.

Hi, I have a control with several textbox controls on it. Now, when I press tab after I edit one of the textboxes, the focus is switched to the next textbox BUT I need to press an additional tab in order for it to enter the "editing" stage. The first tab simply draws a dotted background on the textbox ... and the second one actually pu...

Prevent application execution during ClickOnce install

I have an application that I need to deploy via ClickOnce on a web page, but I need it to only install the app and not execute it automatically after the install is complete. The user should have to manually start the app from the start menu - even after the initial install. Does anyone know how to accomplish this? ...

Using the Xbox 360 in a WPF application

I'm currently trying to use my Xbox 360 controller in my WPF application but all the tutorials online refer to using XNA in a game environment. I was just wondering if there is an easy to get my application to detect my Xbox 360 controller and any movement/button pushes that may come from it. My current setup is visual studio 2010, .NE...

DirectX DirectInput won't detect connected devices

I'm trying to use a joystick in my C# WPF application using directX (using Microsoft.DirectX.DirectInput;), but for some odd reason I keep getting an error in the first line where I try to detect all the connected devices. All I have in my application so far is the following line of code in the contructor: DeviceList gameControllerList...

Overriding mouse over behaviour in WPF combo box

When the list is dropped down an the mouse hovers over an item in the drop-down list, the item becomes highlighted but the selected value shown in the text box does not change unless the item is clicked. I am looking for a way to modify the mouse over behavior in a control that inherits from ComboBox. I tried overriding function like OnM...

WPF, am I a bitmap or a PNG

My goal is to work with bitmaps but store them as PNG bit arrays. I have: BitmapImage imageGrass = (BitmapImage)this.FindResource("imageGrass"); I am curious at this point if this is a bitmap or a PNG. If i user copy pixels I know for sure its uncompressed bitmap. Where I am failing is: PngBitmapEncoder encoder = new PngBitmapEncoder...

WPF: Resources in a GroupBox header

Can I do something like this? <GroupBox.Header> <GroupBox.Header.Resources> <Style TargetType="Label"> <Setter Property="Foreground" Value="White"/> </Style> </GroupBox.Header.Resources> ...

How to change the header background of a listview?

I want to change the gray default background of the header of a listview but I don't know how to do it. Please help! To clarify my needs, I put a screenshot here. ...

WPF displaying differently on different computers

I am running Windows XP on my computer, and another computer also is running Windows XP. In my WPF application, I've changed the styles of my buttons to appear as if they are not highlighting when rolled over, clicked, etc. On my computer, this is the behavior that is occurring. On the other Windows XP system, I am seeing some outlini...

WPF C#: Rearrange items in listbox via drag and drop

I am trying to figure out how to move the items in a pre-populated listbox up and down via mouse drags. I have looked at the Control.DoDragDrop method from microsoft's api, but I still can't get it to do anything. I would appreciate any help since I am new to the visual studios environment, thanks. ...

What should I know to build a framework like WPF?

I want to make this clear: I'm not really going to build WPF from scratch. But ever since I've seen WPF I wanted to be on the WPF team and build WPF. I know WPF considerably but if you just know WPF, you cannot build it. WPF is built on DirectX and uses User32. I think Programming Windows by Charles Petzold is the first book that I nee...

Name a class that puts action in dispatcher queue if its not already there

I have written a simple class that works with a UIElement and an action to invoke. Whenever the action is invoked, it puts the action in dispatcher queue, if its not already there. I use it to reduce number of calls. class NoNameClass { // has element and action in its ctor. void NoNameMethod() { if (!inQueue) { inQueue = tru...

ComboBox that shows all removable devices

I have a combobox (ItemsSource="{Binding Path=AvailableDrives}"). The AvailableDrives property is defined like this: public List<DriveInfo> AvailableDrives { get { return DriveInfo.GetDrives().Where(x => x.DriveType == DriveType.Removable).ToList(); } } It works OK, but i would like that i...

Silverlight ScrollViewer or HorizontalScrollBar

I have ScrollViewer and child Stack panel. I need my HorizontalScrollBar automatically scroll right when content added. How to do this? Items to stack panel added dynamically. P.s. i am trying to use this.scrollViewer.ScrollToRight(); but it not always scrolls to end. ...

ViewModel and binding for dynamically addable comboBoxes

Hi. I didn't find a solution for this but I think it should be doable. I have a number of items in a collection and want to select some of them. Each item has a CanInclude property containing the elements that can be selected if itself is already selected. Item1 CanInclude: Item4, Item5 Item2 CanInclude: Item3, Item4 Item3 CanInclude:...