wpf

WPF - Creating a custom ItemsControl

I'm looking into creating custom controls for WPF and I've found some reasonably useful blogs and such that vaguely go into enough detail but I'm still struggling a bit. Basically, what I'm trying to create is something akin to the infamous 'Coda Slider' but i just don't know enough to get started properly. Can anyone either point me i...

Will wise owl obfuscate wpf projects properly?

We are moving from windows forms to wpf for the next version of the product I work on. We are using wise owl to do our obfuscation and I am wondering if anyone has had experience with this. ...

WPF: How to freeze a ListView header row so that it won't scroll off the screen

Hi, I am new to WPF development, I have a ListView and I want to freeze the header row so that it won't scroll off the screen when the user scrolls the list. The xaml code, I have inherited, looks something like this: <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <DockPanel> <forms:Bindable...

moving mouse cursor off screen in C#

Hello Everyone, I have a wpf window that has a height of 2000 with an actual desktop height of about 1000. Obviously about half of the window is off screen. Even though the window extends below the screen, the mouse will not move down to that area. I do want this content to be off-screen, and I want the mouse to be able to move over ...

Problem with binding Nullable value to WPF ComboBox

I am binding a WPF ComboBox to a nullable property of type MyEnum? (where MyEnum is an enumerated type) I am programmatically populating the ComboBox items like this: // The enum type being bound to enum MyEnum { Yes, No } // Helper class for representing combobox listitems // (a combination of display string and value) class ComboIt...

wpf listview/gridview: hiding repeated content

Hello world, I'm new to WPF and don't know how to implement what I need. My problem: I've got a data bound WPF gridview displaying the results of an SQL query. Some of the columns present repeated data that I'd like to hide. This: occupancy name room --------- --------- ----- Occupied Bob 1 Occupied Ted ...

PreviewLeftMouseButtonDown Listeners Report Different MouseButtonEventArgs.Source For Same Event

I'm getting some unexpected behavior in WPF. Here's my scenario: I have a UserControl on a Window. Let's call it "Surface". It has a Canvas on it. I have a second UserControl. Let's call it "PlayingCard". I have the PlayingCard UserControl added as a Child of the Surface's Canvas. Visually it displays just as it should, on top of th...

ClickOnce - No "Start" menu shortcut

I am publishing a .Net 3.5 SP1 WPF application through ClickOnce. By default, when the user clicks on the published link the application gets installed and a menu and shortcut are added to the client's Start/All Programs menu. How can I prevent the shortcut/menu from being created? (users need to run the application solely by clicking ...

How to display row numbers in a ListView?

The obvious solution would be to have a row number property on a ModelView element, but the drawback is that you have to re-generate those when you add records or change sort order. Is there an elegant solution? ...

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 explain why I did not like it as much as the accepted answer. It is more complex, while the accepted answer does the same thing in a simpler w...

WPF No Events from Controls in RichTextBox

I am using WPF and have a Table inside a RichTextBox control. I need to get the background colour of the table cell to change it gets the focus. My problem is that I can't get the GotFocus or any other events to fire for the TableCell. <RichTextBox> <FlowDocument> <Table> <Table.Columns> <TableColumn...

Refactor XAML code with binding

I try to refactor such XAML by introducing new user control: <Window ...> <ComboBox ItemsSource="{Binding Greetings}" /> </Window> After adding a control I have ControlA XAML: <UserControl ...> <ComboBox ItemsSource="{Binding Items}" /> </UserControl> ControlA C#: public static readonly DependencyProperty ItemsProperty = Wp...

Why is my WPF Path Animation flickering?

Why does the following animation flicker and act goofy on MouseLeave? If it can be repro-ed, I'll post a screencast. <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Canvas> <Path Fill="Blue" Margin="15,15,15,15"> <Path.Data> <!...

How to style a WPF Expander Header?

Hello, I would like to apply a style on a WPF Expander Header. In the following XAML I have an Expander but the style is for all of it not just for the header. Thanks. <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="640" > <StackPanel> <Stac...

WPF - UserControl default Content attribute

I'm creating a UserControl and I just can't remember the name of the attribute which you use to decorate the property which you want to act as the default content property. To give a concrete example, say i have a property called 'Title' which i can set using property syntax like this - <local:myControl Title="the title"/> But the...

CollectionViewSource Filter not refreshed when Source is changed

Hi, I have a WPF ListView bound to a CollectionViewSource. The source of that is bound to a property, which can change if the user selects an option. When the list view source is updated due to a property changed event, everything updates correctly, but the view is not refreshed to take into account any changes in the CollectionViewSou...

WPF ListBox problem with resolution

Hi, I have a WPF ListBox control. It can have a long list of items. When i am working with the normal screen resolution i.e 1024 * 768, it shows the listbox with scrollbar properly, if I mention the MinHeight and MaxHeight for the listbox. and when I switch to another resolution, which is 1280 * 1024, ideally, the listbox should fit to...

WPF - ItemTemplate not acting as expected.

I have a UserControl which I'm using to display a list of UIElements. The control consists of a single ItemsControl with it's ItemPanelTemplate switched for a horizontal StackPanel, its ItemsSource bound to a DependencyProperty exposed by the UserControl and its ItemTemplate set in the UserControl.Resources. Everything works fine exc...

Getting a column definition by name in wpf

For example: <Grid Name="TestGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Name="TestColumnName" Width="*" /> </Grid.ColumnDefinitions> </Grid> I would like to be able to access the column definition in code using the name 'TestColumnName'. ...

How to further decouple this WPF example toward MVC, MVP, or MVVM?

I've decoupled events in this WPF application in the following way. What is the best way to continue decoupling? Shell.xaml: <Button x:Name="btnProcess" Content="Process" Margin="10"/> Bootstrapper.cs: public void Run() { Shell shell = new Shell(new Customer()); shell.Show(); } Shell.xaml.cs: public Shell...