wpf

Drawing Basic Shapes in WPF InkCanvas

Hi..I am working on a paint like application in wpf.I want the users to be able to add some drawings over images or plain surfaces.Also i want to draw some basic shapes like line,ellipse or a rectangle.I am trying to work with an inkcanvas,where i can do freehand drawing,but i cant draw shapes like in paint.Can anyone guide me and provi...

Binding depending of type in WPF

I have a ParentViewModel which has ObservableCollection named Notices. public class Notice { public string Content { get; set; } public NoticeType Type { get; set; } } I have static controls at user control where I want to bind this observablecollection to this static controls. And I don't know how bindin...

Open all files when user right clicks and selects "Open With".

I have an application written in WPF/C# that can take multiple files as command line arguments. When I run it from the command line with multiple files it opens all of them. When I select multiple files in an explorer window and drag them to the applications icon it opens all of them. But if I select multiple files in explorer and rig...

Click event for controls below other controls

Hello, I have two controls A and B. Control B is placed over A. When B is clicked only it's clicked event is fired, however I need the click event of A to fire too. Can this somehow be realized using routed events? Here's a screenshot of the controls: Of course this case is just a reduced example, I'm looking for a general way to ra...

Conditional Trigger is it possible?

Hi I have a situation where I need to check a property "HasDelivered" if true. the foreground color of my textBlock should be green else red. Any ideas or suggestions ...

Whats wrong with this trigger?

I'm learning about WPF templates and I'm creating one for a button. I'm using a trigger to change the Fill property of the Ellipse on 'IsMouseOver'. When I set the trigger to the 'Fill' property directly, it works. But when I try to reference a specific SolidColorBrush, I get a compile error. This works: <ControlTemplate x:Key="Ghos...

WPF - Any ideas why datatrigger not firing?

My listbox is defined below. "Properties" is a BindingList which I am changing one of the items but the Image style is not being updated. Any ideas what I might be missing? <ListBox x:Name="lstProperties" Margin="0,0,5,0" ItemsSource="{Binding Properties}" Sel...

Add style to a Data template

I have the following Data template with triggers: <DataTemplate.Triggers> <DataTrigger Binding="{Binding IsCalled}" Value="Yes"> <Setter TargetName="labelNumber" Property="Background" Value="Green" /> <Setter TargetName="labelNumber" Property="BorderThickness" Value="5" /> <Setter Targ...

How do I make a multiple stacks of controls (columns) scrollable?

Hi, so I'm new to using WPF and can't figure out how to make an easy way to have multiple columns of controls that can be added / subtracted easily and still have it scrollable. So for example (my situation), I have two text boxes and a button that need to be added for however many "items" there are. I would want these together in a 3 co...

wpf ItemsControl binding problem

I bind to a ItemsControl in my codebehind: ColumnVisibilityItems.DataContext = gc.ColumnVisibility; where ColumnVisibility is a ObservableCollection, also tried it with dictionary.. my markup <ItemsControl x:Name="ColumnVisibilityItems"> <Label Content="{Binding Path=Name}" /> </I...

List with owning and not owning stuff for object

I have: public class Extra { public string Name {get;set;} } and I have public class CarViewModel { public ObservableCollection<Extra> OwningExtras { get; set; } public static IEnumerable<Extra> AllExtras { get { return Extra.GetAllExtras(); } } public CarViewModel(...

Question about this xaml markup extension

Hi, I'm trying to understand what does the markup extension for the x:Key attribute below do and what kind of markup extension is it? <Window x:Class="App1.Window1" xmlns:dxg="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt; <DataTemplate x:Key="{dxg:Example ResourceKey=Example}"> <dxg:TextEdit Text="123/> </DataTemp...

wpf data grid - moving from one cell to another cell

how to capture event when moving from one cell to another in same row. ...

Displaying 24hr clock in WPF Datagrid

I was wondering, how do I show a 24hr clock in a WPF datagrid? At the moment, the datagrid has set itself to 12 clock, using am & pm which is just plain confusing. In the datagrid it has a simple column binding ...and I get the following 6/29/2010 10:46:42AM 6/29/2010 11:14:10PM ...

WPF - Styles with Custom Properties

Hello. I'm developing a document number checking on my application and I wrote an attached behavior to textbox to check the text. Here's the behavior code: public class CPFTextBehavior : Behavior<TextBox> { static readonly DependencyPropertyKey IsCPFPropertyKey = DependencyProperty.RegisterAttachedReadOnly("IsCP...

No touch deployment + ElementHost

We have a WinForms application that is executed through no touch deployment. We're hosting a WPF control that has a simple ListView control with GridView. Every time we try to launch it through the no touch, we experience a ver long rendering time. However, when it's executed directly off the dev machine, it renders very quickly. Are th...

How to unit test a class using System.Windows.Threading.Dispatcher

How do I unit testing a class which makes use of System.Windows.Threading.Dispatcher? I am following the MVVM pattern in the setting of WPF. As part of this I am creating a DispatchingBlah class following the pattern used for DispatchingQuoteSource that I saw in this video (see 1:06:16 ish). I want to test that my class has queued the...

How to disable WPF ContextMenu animations?

I'm trying to hunt down what bit I need to tweak to get ContextMenus in WPF to stop animating when they appear/disappear. From what I can tell, WPF creates a Popup to host the ContextMenu. The Popup looks at its PopupAnimation property and decides how to animate. What I want to do is always have that set to "None". I've tried setting a...

WPF - Dependency Properties Error

Hello again. I'm working on a WPF project, and my intention is to make two specific RadioButtons alter properties of another specified Component. But for now, i'm just trying to store a String inside the RadioButton. For that, I've created a behavior class: public class AdjustBehavior : Behavior<RadioButton> { With this property...

Why do DownloadStringAsync results have strange characters when XmlReader results don't?

I am using an RSS feed as a data source. I've adjusted how I retrive the data to use the WebClient.DownloadStringAsync method. Before I was using XmlReader.Create method. I'm then using the results as a data source to bind to a TextBlock in WPF. Since I made the change when I display my results all the special encoded characters are app...