wpf

Imitate ListView on left side of Windows Explorer

I need a ListView that is like the listview on the right side of Windows Explorer. The ListView needs to have the expandable arrows. My idea, maybe use the ListView in a TreeView tempate? ...

Constant Memory Leak in SpeechSynthesizer

I have developed a project which I would like to release which uses c#, WPF and the System.Speech.Synthesizer object. The issue preventing the release of this project is that whenever SpeakAsync is called it leaves a memory leak that grows to the point of eventual failure. I believe I have cleaned up properly after using this object, b...

WPF - Set Focus when a button is clicked - No Code Behind

Is there a way to set focus from one control to another using WPF triggers? Like the following example <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefini...

WPF: Why would this cause a stack overflow exception?

When I add this style, it breaks my application with a StackOverflowException. <Style TargetType="GroupBox" BasedOn="{StaticResource {x:Type GroupBox}}" > <!-- <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" /> --> </Style> In case it matters, I'm using the ShinyBlue theme. Any ideas what would cause thi...

Change Image OnMouseOver in ControlTemplate

Here is my XAML: <Style x:Key="ExpanderStyle" TargetType="{x:Type ToggleButton}"> <Setter Property="IsEnabled" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Image Source="/Images/SHCalendarLeftArrow.tiff" /> ...

WPF: Control that never causes childern to NOT consume all available space.

Right now I have a problem with stack panels inside dock panels. Often the stack panel is taller than necessary for the contents, so the contents are stretched. Is there something I can place in or around the stack panel to mean "don't cause children to consume all avaialble space". ...

Style expander buttons of TreeView

Here is my XAML: <Style x:Key="ExpanderStyle" TargetType="{x:Type ToggleButton}"> <Setter Property="IsEnabled" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Image Source="/Images/SHCalendarLeftArrow.tiff" /> ...

WPF: Why is it VisualTreeHelper.GetDrawing(Visual v) and not Visual.GetDrawing() ?

Just curious -- prima facie it seems more awkward and less discoverable, but is there a good reason? ...

WPF: How do I style a column in a ListView

Ok, this is what I have so far: <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:s="clr-namespace:System;assembly=mscorlib" Title="MainWindow" Height="350" ...

Handling alpha channel in WPF pixel shader effect

Is there something unusual about how the alpha component is handled in a pixel shader? I have a WPF application for which my artist is giving me grayscale images to use as backgrounds, and the application colorizes those images according to the current state. So I wrote a pixel shader (using the WPF Pixel Shader Effects Library infrast...

WPF: GridViewColumn resize event

I'm using ListView with GridView. Is there GridViewColumn resize event? ...

Databinding - setting default value

I have code like this, in pagefunction making up a wizard: <TextBox Name="txtDate" Text="{Binding Path=Date}"></TextBox> The user types in and clicks next, object sent to next page with this data. But if I set <TextBox Name="txtDate" Text="{Binding Path=Date, TargetNullValue='2010-01-15'}"></TextBox> So I can have some "example" t...

WPF & Linq to Entities: How can I dynamically display data where it is changed by another user?

Hi, apologies in advance for the noob question, I've only been using WPF for a few weeks and SQL Server for a few days, but I can't find out how to do this anywhere on the web so far. I have a database on SQL Server with one table in it 'User', and have an application that can display data (Username) from that table in a ListView using ...

Confusing WPF draw behavior

I'm currently trying to persist a canvas to a bitmap, and I've run into some very peculiar behavior. The source code for the 3 following cases appears at the end of the post. Case 1: A red rectangle appears in the output file (test.png), as expected. Case 2: No red rectangle appears in the output file. Case 3: No red rectangle appear...

Serializing a WPF Image

I'm trying to understand how image serialization works in WPF. I have the following class: [Serializable] public class TestClass : ISerializable { public TestClass() { } protected TestClass(SerializationInfo info, StreamingContext context) { SerializedImage = (byte[])info.GetValue("SerializedImage", typeof(byte[]))...

Responding to "Back" and "Forward" buttons in WPF

I was planning to add support for the Back and Forward buttons, found on many keyboards, to my WPF app, but I'm struggling to get them to work. I've tried using a standard KeyBinding to BrowserBack and BrowserForward, no joy. I tested the code with the ESC key to make sure it was working in principal, and that key was fine. Nextup I ha...

WPF Merged ResourceDictionary inconsistencies

Hi everyone, I have a ResourceDictionary, which consists of a Brush object and a Style using this Brush object for several animated properties in its Template property (via StaticResource markup extension). The problem is; when I merge the dictionary with the global application ResourceDictionary (Application.Resources) the Brush does n...

How to select item with keyboard letter key in WPF combobox?

I have a WPF combobox and I want to go to items (for example) start with "e" in combobox. How? <ComboBox ItemsSource="{Binding Roles}" SelectedValuePath="Id" ItemTemplate="{StaticResource ComboBoxDisplayName}" SelectedItem="{Binding SelectedRole}" Width="150"...

mouse click event on Tab header in Tabcontrol

I have my tabcontrol made in WPF with C#.But i display the window like a bar by using window position.I mean while displaying only tabheader will be display.My tab header are in leftside. When i press the tabheader the window width will increse to fit the tab items content. So i want the click event of tab headers in tabcontrol.How can i...

WPF ListBox Databinding & Events

My problem is rather simple. I have a ListBox, containing Thumnails (Image) <ListBox Name="ListBox_Thumbnails" ItemsSource="{Binding}" DataContext="{Binding Source= {StaticResource ThumbnailListSource}}" Width="120" HorizontalAlignment="Left" Margin="-1,26,0,54"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> ...