wpf

Drag&Drop-adorner in deeply nested visual trees

We have a WPF application that has custom windows on a canvas which in turn contain custom controls (the main canvas containing the custom windows is again custom control displaying stuff). So basically the visual tree looks like this (without implicit Borders and other things): - Windows - Canvas - WindowMgr - CustomWindow ...

Silverlight opacity clip

Can the opacity of a clipped region be adjusted? Can you actually say for the stuff that is not in the clipped region, show it at some level of opacity? ...

WPF: Read only say TextBox and binding.

Say I have a grid and I click an object and it displays in a detail screen,And I don't want the user to edit some data so I set the TextBox as disabled? then will binding work.Basically what I want is the TextBox to be greyed or disabled ya know? Well how about it in WPF? Can someone explain? ...

How can I avoid recursion when updating my ViewModel properties?

In my View I have a slider and a combobox. When I change the slider, I want the combobox to change. When I change the combobox, I want the slider to change. I can udpate one or the other, but if I try to update both I get a StackOverflow error since one property keeps updating the other in an infinite loop. I've tried putting in a Re...

How can I tell my ViewModel that the user is changing text in the TextBox?

So let's say I have an MVVM application and I want the user to fill out a TextBox and while he is filling it out, I want to check to see if he has typed in the last name of a customer yet. Here is how I get my ViewModel to know when the user has changed the item in the ComboBox: <ComboBox ItemsSource="{Binding Customers}" Ite...

Error in XAML - The TypeConverter for "Style" does not support converting from a string

I have a textbox that I want to be watermarked. In my window.resources section I added the style included in its entirety below. When I set the style on the textbox, Blend 3 Beta displays the following message: 'The TypeConverter for "Style" does not support converting from a string' What is going on and how do I fix this? <Style x:...

WPF Databinding CheckBox.IsChecked

How would I bind the IsChecked member of a CheckBox to a member variable in my form? (I realize I can access it directly, but I am trying to learn about databinding and WPF) Below is my failed attempt to get this working. XAML: <Window x:Class="MyProject.Form1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:...

Linq and ObservableCollection

Hello everybody, I have a problem with Linq and ObservableCollections in my WPF application. Context of the problem: I've created a very simple SQL database with two tables: User and BankAccounts. The User Table has an one-to-many relationship with the BankAccounts Table. Next I've created Linq-to-SQL dataclasses, which worked fine ==...

How do I print an Image from a Uri?

I am attempting to print a JPEG file that I reference using a Uri object and am having some difficulties. I found that while the image was printing, it was cropped slightly and was flipped and mirrored. I'm guessing that the crop was caused by a size not being set properly but have no idea why it's being flipped and rotated. Assuming tha...

ElementName Binding from MenuItem in ContextMenu

Has anybody else noticed that Bindings with ElementName do not resolve correctly for MenuItem objects that are contained within ContextMenu objects? Check out this sample: <Window x:Class="EmptyWPF.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...

Will making WPF forms in VS2010 be easier than it is now?

Will making WPF forms in VS2010 be easier than it is now? I’m just a beginner and I’m finding just learning C# itself is a ton of info to get my head around. But I’ve seen some projects done with WPF and they look awesome. Is it worth my time to start looking into WPF now, or wait till VS2010 where, if I understand correctly, there are b...

wpf passwordbox caret

Hi all, How do I use a passwordbox control with a virtual keyboard using WPF? With the textbox control, it's fairly simple to just move the caret to the next text position; not so with passwordbox, which doesn't expose the caret position. Should I just derive my own? Seems like weak sauce. ...

Autosizing templated column in a ListView based Multicolumn treeview

Hi, I'm using the multicolumn treeview control which I found here http://www.codeproject.com/KB/WPF/wpf_treelistview_control.aspx The first column in this control which consists of a simulated tree view control needs to be autosized when a node is expanded/collapsed. Any help? Sample XAML <UserControl x:Class="ListViewAsTreeView.Xml...

WPF: How to make a "pushlike" checkbox?

I would like to make a CheckBox that looks exactly like a button. My initial feeble attempt doesn't work at all. <CheckBox x:Name="test"> Testing! <CheckBox.Template> <ControlTemplate> <Button> <ContentPresenter/> </Button> </ControlTemplate> </CheckBox.Template> </Chec...

Parent window intercepting accelerator

Hi, I have a window that I've placed into another application. In this case, I have a custom application that I injected into a Outlook 2003 Window. I'm having an issue where the parent window (Outlook in this case), is getting WM_COMMAND messages when I press the backspace key in my application. From my limited Win API experience thi...

Can't update textbox property using DataBinding

I have a custom window which have two depencency properties: Boolean? ValidationStatus, and string ValidationMessage. Binding these properties works fine but trigger doesn't seem to be triggered when these values change. What am I doing wrong? <TextBlock x:Name="validationTextBox" Grid.Row="1" Grid.ColumnSpan="2" Text="{...

WPF Composite Controls

I'm trying to create a reusable UserControl in WPF that has a Label and a TextBox. I want to add properties to my UserControl to bubble up the Text fields of both child controls up to the parent for easy binding. I read that I need to a little bit of hocus pocus by adding owners to DependencyProperties. Here is my code now. It seems ...

WPF TreeView - Force SelectedEvent on Item that is already selected

Hello All, Summarized Question: In the WPF TreeView, how can I force the selected event on an item that is currently the selected item? Detailed Info: I am trying to add functionality to my WPF TreeView by adding multiselect using shift(for a range) and control(for toggling selection of an item). I've implemented my own SelectedItems c...

How would I make a ComboBox that displays arbitrary content as part of the item template?

I need to create several combo boxes to represent enumeration values. I want the values to be represented with some graphical preview to the left and text to the right. The "preview" part of the display might be a control, an image, or some other content. I've tried two approaches and failed both, so I'm curious what some alternatives...

WPF - Implement ItemTemplate for an ItemsPresenter?

I've been working on a SplitButton control for WPF and its basically done, but I'm trying to go through all the possible properties that can be set on it and make sure they are actually implemented. I mostly have only two properties left to implement which is the ItemTemplate and ItemTemplateSelector (and AlternationCount, okay so 3 prop...