wpf

WPF Open Combobox popup on Focus or GotFocus

Hi, I am trying to open the combobox popup when it is focused using Style/Event Trigger I used the following code in my Combobox control Template: <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> <Grid > <ToggleButton Grid.Column="2" Template="{DynamicResource ComboBoxToggleButton}" x:Name="...

WPF ComboBox ControlTemplate Background problem

This is an example of a ComboBox's ControlTemplate. CLICK HERE I've tried to set the Background / add a trigger to change the background when the ComboBox is focused (with a tab key for example), both without success. I don't even understand why it isn't included by default ! (compared to the original generic template) ...

Default custom ControlTemplate is not applied when using Style

Hi all, I have created a default style for a Button including a custom ControlTemplate like so: <Style TargetType="{x:Type Button}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Background" Value="White"/> <Setter Property="BorderBrush" Value="Black"/> <!-- ...other property setters... --> ...

intercept RelativeSource FindAncestor

I have a WPF application which runs as a excel plugin, it has its visual tree like so Excel ElementHost WPF UserControl WPF ribbon bar control Now any controls sitting on the WPF ribbon bar control are not enabled when the plugin is loaded within excel. See error below System.Windows.Data Error: 4 : Cannot find source for bin...

Expression Studio - v2 good enough for learning?

I have VS 2008, and looking forward to moving fairly quickly to VS2010. Our applications (we only have a few) are all winforms apps - mostly VB. I want to start to learn WPF. My version of Expression Studio is version 2. I have heard that the improvements made from version 2 to version 3 are significant. If it follows the paradigm o...

BindingExpression with XPath cannot bind to non-XML object

System.Windows.Data Error: 43 : BindingExpression with XPath cannot bind to non-XML object.; XPath='CarModel/PercentFront/@Visible' BindingExpression:Path=/InnerText; DataItem='String' (HashCode=-671055389); target element is 'StackPanel' (Name='PnlPercentFront'); target property is 'Visibility' (type 'Visibility') CurrentCarConfig My s...

Is there a performance benefit to explicitly specifying OneWay binding when setting up bindings in WPF?

A project I'm working on is suffering from some minor performance issues. Our team is performing many small improvements to achieve larger gains in performance. We've managed to help the application out some by making some more obvious changes, and we've looked to data binding to provide some additional improvements. I know the default b...

WPF Templates error - "Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception."

I've just started experimenting with WPF templates vs. styles and I'm not sure what I'm doing wrong. The goal below is to alternate the colors of the options in the menu. The code works fine with just the , but when I copy and paste/rename it for the second segment of "MenuChoiceOdd" I get the following error: > Provide value on 'Syst...

ObservableCollection DataGrid

I bound the ObservableCollection to the dataGrid itemssource. the collectionChangedEvent of the observable Collection is getting called only when we add, delete, remove. But not firing when we update the record. how to fire the event for Update too? ...

WPF DockPanel doesn't respect the "Filled" control's desired size

I have the following Xaml (simplified for brevity, but will repro the problem in Xamlpad or Kaxaml): <DockPanel Width="400"> <TextBlock DockPanel.Dock="Left" TextWrapping="Wrap"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum massa metus, ornare in fringilla nec, fringilla at orci. Nunc p...

Mediaelement repeatbehavior fails when binding to xpath

I'm trying to get video's to repeat forever using MediaElement. I found the code below at http://msdn.microsoft.com/en-us/library/ms741866.aspx and it works fine. <!-- The MediaElement control plays the sound. --> <MediaElement Name="myMediaElement" > <MediaElement.Triggers> <EventTrigger RoutedEvent...

WPF - Animating object lower/higher in visual tree

Hi. I have following problem. I created Style for ContentControl that enables moving/dragging of specific item. This is created with help of MoveControl (: Control) that controls mouse down/move/up events. In this class DependencyProperty IsDragging property is defined, that i want to use to fade in/out item when it changes state. Xa...

How can I write a folder of WPF image resources to disk?

I have a folder in my WPF app "Images" that has several .png files with their Build Action set to Resource. These are built into my binary since I can reference them in XAML. I would like to write these to disk in the temp folder. How do I do this? I have found several answers referring to Embedded Resources, but not just plain resourc...

When are keybinding preferable to handling key-up/key-down (.ect) events?

When are keybinding preferable to handling key-up/key-down (.ect) events? ...

Need fully qualified type name

Hi, I need to resolve an assembly and type at runtime and I need to find the fully qualified type name. For some reason I cannot get it right, as I keep get an exception saying it cannot find the type specified. The app.config file, in which the assembly to look for is defined, looks like this: <configSections> <section name="mod...

Expose UserControl property to XAML

WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them from the XAML of a user control declaration. Example: <UserControl ... > <UserControl.CommandBindings> ... </UserControl.CommandBindings> <UserControl.Resources> ... </UserControl.Resources> </User...

WinForm - WPF integration; Piece by Piece

I have a medium sized WinForm App (1 Form that hosts 40 user controls) that we use in house. I want to migrate over to WPF but I cannot do a Mass ReRelease. My idea was, for now, to recreate the App 1 User Control at a time in WPF and have that hosted in the existing WinForm App. I would make them look nearly identical, at this poin...

Exception showing a erroneous web page in a WPF frame

I have a small application where i need to navigate to an url, I use this method to get the Frame: public override System.Windows.UIElement GetPage(System.Windows.UIElement container) { XmlDocument doc = new XmlDocument(); doc.Load(Location); string webSiteUrl = doc.SelectSingleNode("website")...

How to get a tool window title bar height in WPF ?

WPF includes the title bar height in the total window height instead of using only the client content area height. Is there a way to disable this behaviour? If not, how can I get the height of a tool window title bar? I'm aware of the SystemParameters.CaptionHeight property and the SystemParameters.WindowCaptionHeight property but t...

WPF CheckBox's IsChecked property doesn't match binding source's value

In my WPF application I have a CheckBox whose IsChecked value is bound to a property in my viewmodel. Notice that I have commented out the actual line which sets the value in my viewmodel. It's the standard pattern: View.xaml <CheckBox IsChecked="{Binding Path=SomeProperty}" /> ViewModel.cs public bool SomeProperty { get { retur...