wpf

WPF RepeatButton in template doesn't repeat

Hi, Wondering if anyone knows the answer to this. I use repeat buttons elsewhere in the application and they work fine, only when I use it within a data template it doesn't repeat, it only fires once every time you click it <RepeatButton Content="+" Width="25" Command="{Binding DataContext.IncreaseQueueTimeCommand, R...

How to animate a resource in XAML?

In an XAML document, I have a gradient brush as a resource and a bunch of shapes that use this resource. I would like to animate the brush using a storyboard, but I don't know how to set the brush in resources as the target of storyboard. Simply using its name does not work, {StaticResource name} does not work either. Is it even possible...

WPF Data Binding : enable/disable a control based on content of var?

I have a button on my form that should only be enabled when an item is selected in a treeview (or the listview in a tabitem). When an item is selected, it's value is stored in a string member variable. Can I bind the IsEnabled property of the button to the content of the member var? That is, if the member var is not empty, enable the bu...

WPF: How do I prevent tearing with WriteableBitmap?

I'm using a WriteableBitmap to display images I process myself at around 20 frames per second. This question (WPF: More efficient way of displaying quickly-changing images?) and this question (How to display quick-updating images without large memory allocation?) indicate that the best way to do this is by using a WriteableBitmap. The ...

Dependency Property Uses in WPF

I am having a hard time figuring out good reasons for the dependency property. Why the System.Controls.TextBox "Text" property a dependency property and not a normal property? What benefits does it serve being a dependency property? One of the things I am trying to accomplish is to add a ValidationRules property to my UserControl which...

How to convert WPF MouseDevice.GetPosition(null) to screen coordinates?

How can you convert the System.Windows.Point that is returned by MouseDevice.GetPosition(null), which is relative to a WPF window into screen coordinates. There's this hack (How to get control location in screen coordinate system) but it's almost over two years old and will only work under certain constraints. As that article describes...

problems after copying XAML controls from WPF Application to class library

In the process of refactoring some code I encountered several build errors like these: Library project file cannot specify ApplicationDefinition element. The project file contains a property value that is not valid. How can these errors be resolved? ...

WPF - Change a button's content in a style?

I'm trying to do something similar to this: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Button> <Button.Style> <Style TargetType="{x:Type Button}"> ...

Hide a ContentControl

Below is a fine piece of artwork that represents a WPF form with a listbox on the left and a content control on the right. I would like to set it so if the list box is empty, then the content control is invisible. What property/event should I hook to? ----- ----- | a | | c | | b | | | ----- ----- ...

WPF ToolBar: how to remove grip and overflow

In a nested WPF ToolBarPanel-ToolBar-Menu we want to get rid of the grip handle to the left and the overflow area to the right. they are both grayed out, but we'd like them to not be displayed at all. any ideas on how to accomplish that? just in case my terms aren't entirely correct, if you look at the image in Figure 3 of the link bel...

Will Visual Studio 2010 Provide out-of-box support for the Ribbon in WPF?

I don't see it in the beta, and I don't want to jump through ridiculous hoops (http://www.codeplex.com/wpf/Wiki/View.aspx?title=WPF%20Ribbon%20Preview). ...

WPF ListView turn off selection

Hi everyone, I have a simple WPF ListView and a simple question: Is it possible to turn off the selection, so when user clicks row, the row is not highlighted? I would like the row 1 to look just like row 0 when clicked. Possibly related: can I style the look of the hover / selection? Eg. to replace the blue gradient hover look (li...

WPF MVVM - Command binding inside of an ItemsControl

I'm currently converting a small WPF project to MVVM. I have a List<CustomObject> in the ViewModel of the main window that my ItemsControl binds to and uses a DataTemplate to build the UI of each element. My old code used an event handler inside the DataTemplate to handle a click event. I want to use some kind of command binding to el...

Sort of scheduler

I need to implement something. Something that could do some certain task in my program. For example every ten seconds, write something into a log in a file. Of course it suppose to run in a background thread. Where should I dig? I am not so familiar with multithreading. I've heard about BackgroundWorker class, but I'm not sure if it is ...

Silverlight Canvas on Scrollviewer not triggering

Why does this work so well in wpf <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <Canvas x:Name="MyDesigner"> </Canvas> </ScrollViewer> Now when I do the same thing in silverlight and load an control "that can be dragged" the scrollbars are not triggered, when I drag out of view, nothing happens...

Does MS provide some way for user to manage input bindings?

What I mean is as user I would like to change some gestures from ones set by developer. So as developer what should I do to provide this functionality? Does MS provide any extension points for this? If anybody read about it implemented anywhere, please share. ...

ItemsControl with horizontal orientation

Do you know any controls inherited from the ItemsControl that have horizontal orientation of items? ...

Julmar WPF helper parameters

Hi, I am using the Julmar helper classes for WPF so that I can call a custom ICommand on an event such as MouseEnter on a text box like so: <TextBox Text="hmm"> <julmar:EventCommander.Mappings> <julmar:CommandEvent Command="{Binding DataContext.IncreaseQueueTimeCommand, RelativeSource={RelativeSource FindAncestor, Ancest...

How do I get input bindings which would trigger routed command?

I have a menuitem which have a command assigned to it (MyCommands.Indent) and two text areas, both having an input binding triggering MyCommands.Indent. The hard part is that input bindings have different gestures and I would like these gestures to change in MenuItem. So my question is: How do I get input bindings which would trigger th...

WPF - Shut-off autogen of Main in App.g.cs

I'm learning WPF. I want to provide my own Main method in my App.xaml.cs rather than getting one generated for me in App.g.cs. However I keep getting conflicts because I haven't found out how to stop an additional Main from being generated. Is there a setting in my project file or elsewhere that controls this? ...