wpf

WPF Datagrid - How to validate multiple rows and mark all invalid ones?

Hi, I have a datagrid with rows where the validation depends on his siblings. So far I'm using BindingGroups and a custom ValidationRule to validate multiple rows a the same time. But I can't figure out how to change the appereance of the invalid row entries. I return a ValidationResult and my grid gets a red border but my style gets ign...

LINQ to SQL as databinding source for WPF Treeview

I wonder if someone could provide a simple example of the following. (preferably in VB.Net): I have an SQL database with related tables and I am successfully using LINQ to SQL in other areas of my application, but am a little stuck with the Heirarchical Treeview. I would simply like to use a LINQ query from the database as a source fo...

WPF Masked Textbox with a value that does not contain mask

I need a WPF Textbox that displays a phone number as "(555) 555-5555" but has a value of "5555555555". All of the examples I'm seeing have the ability to mask the control on the UI but that affects the bound property of my view model so that the property value has the extraneous ()- characters. ...

Seekbar problem in wpf media element when playing a streaming video

Hi, I'm having a problem with the mediaelement in WPF. I need to make a audio/video player that plays media from a streaming server (my streaming server) the problem is that I can't get the seek bar to work. The same video played from "c:\video.ogv" works perfect and from "http:\127.0.0.1\video.ogv" has no seek bar, the video plays fine...

Get DynamicResource Binding in WPF

Can any one help me to get DynamicResource Binding in WPF by code? I have set binding Like follow, TextBlock Background={DynamicResource ColorA} Name="TB" in Xaml. and i need to get the - TB's background is binded to "ColorA". how can i access this DynamicResource Binding Expression in WPF by coding. when i try to get TB.Background, ...

Binding DataGrid to List in wpf

I trying to bind a List to a DataGrid. Here is the code snippet: public class Parson { public string LastName { get; set; } public string FirstName { get; set; } public Parson(string lastName, string firstName) { LastName = lastName; FirstName = firstName; } } public class Persons : List<Parson> { ...

WPF Programming Examples (Photo widget)

Anyone know (or can provide) a programming/XAML example with WPF of a image collection widget similar in principle to that of Picasa? ...

WPF TabItem Header Images

I've got a TabControl in WPF with 3 tabs, and each tab has an image next to the title of the tab. Here's an example <TabItem> <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Name="img" Height="auto" Width="auto" Source="images/1.png" /> <TextBlock...

Bind to ancestor of adorned element

Hi there! Here is the case: <DataTemplate x:Key="ItemTemplate" DataType="local:RoutedCustomCommand"> <Button Command="{Binding}" Content="{Binding Text}" ToolTip="{Binding Description}"> <Button.Visibility> <MultiBinding Converter="{StaticResource SomeConverter}"> ...

Disable Windows 7 touch animation in WPF

In Windows 7 when you touch the screen there is a short animation that occurs at the touch point. In my WPF app I want to display my own touch points, without showing the one supplied by Windows. Any ideas on how to disable them in an app? ...

How to bind a TabControl to an ObservableCollection in XAML

I have the following line of code in my code-behind class. TabControl.ItemsSource = ((MainWindowViewModel)DataContext).TabItemViewModels; I would like to move this to the XAML file. In brief, There is a MainWindow class representing the main-window. There is a TabControl placed on the main-window. There are 2 view-models called Mai...

How can I disable the window icon context menu.

If you left click on the top left icon in a window's title bar a context menu comes up (Restore, Move, Size, etc.) How can I disable the menu? My apps Ribbon application button overlaps that area and it comes up sometimes while pressing the button. IconVisibility="Collapsed" or IconVisibility="Hidden" hides the icon but the click even...

Silverlight ImageBrush not rendering (with Bing Map Control)

I'm trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can't seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather than anything specific to the Pushpin object. Pushpin pp = new Pushpin(); ... Uri imageUri = new Uri(@"myImage.png", UriKind.Relative); ...

Load image into memory immediately

I need to open all frames from Tiff image in WPF into memory and then delete the source. And after that I eventually need to render that image (resized according to window size). My solution is quite slow and I cannot delete file source before the first require. Any best practices? ...

How can I set Regular Expression on TextBox?

How can I set a regular expression on WPF TextBox? I want the textbox to accept input in some predefined format. Is it possible? ...

How to design WPF things more visually, a-la WinForms?

I constantly feel that designing a form layout in WPF is like designing a websites layout. Is there a tool that'll let me set things visually? I'm coming from mainly a WinForms environment and it's tiresome to spend 2 hours laying out a form design and having it not come out exactly how you want it. Tweaking numbers, etc. is very tiresom...

Use s checkboxcolumn if row of datagrid needs to be selectable

I use a datagrid with a checkboxcolumn in c# 4.0. I right now I need 2 clicks to change the state of a checkbox if I enable row selection. One click selects the row and the second changes the state of the checkbox. How can I enable row selection, but keep the 1 click for changing the state of the checkboxcolumn? <DataGrid Auto...

Bind Button.IsEnabled to custom validation with XAML?

I am sorry I didn't know how to title my question any better, you name it if you got a good 1. I have an entity Contact. this person has navigation properties: Address, Phones (A collection of Phone). They all implement a custom interface that exposes a property IsValid. In the contact edito form I have an OK button, I want its IsEnab...

AutoComplete textbox and "Hide Pointer While Typing" in windows

How can the "Hide Pointer While Typing" option be disabled by application? I'm having an issue with the cursor hiding and not getting it back without pressing escape or losing window focus. The application has been written in C# and uses WPF. A technology specific answer is not required because it'll likely be possible using any technolo...

How to bind a Control.Property to a property in the code-behind?

Hello. I have a TextBox in my WPF window. I have a property in the code behind called Text as well. I want the text property to be bound to the Text property (i.e. when the value changes in the property the textbox value should also be updadated. Thanks ...