wpf-controls

Resizing Border control

I've got controls strewn around a Canvas that the user can manipulate, and I'd like to make it so that the user can resize these controls by dragging a border edge. I could write a custom control, but before I dive into that, I'd like to find out if anyone has solved this problem already. ...

Keyboard Navigation fails when there are hidden items in TreeView

So I have a TreeView like the one below, with certain items being hidden. If I try to go through the tree using arrow keys, I get stuck at the items surrounding the "collapsed" items. Try it yourself. <Window x:Class="Example.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mic...

How to control the Visibility of a textbox with radio button "IsChecked" property?

How to control the Visibility of a textbox with radio button "IsChecked" property? I have a Two textbox's let say txtbox1 and txtbox2 and I want to bind the visibily of both these textboxes based on the radio button IsChecked property. Below is the XAML code I am trying with: <RadioButton x:Name="radioBtn" ...

WPF Setting on a Control Template

Hi, General question. I have a ControlTemplate that is reasonably complex. Several TextBoxes etc. I can't use TemplateBinding to bring all the properties to the surface so that I can set all the styles. Is there a way for a Style to 'delv' into the controls within a control to set values? Hope my question is clear without an example...

WPF GridView: "Newspaper" Column?

I'm not sure how else to describe this, outside of calling it a "newspaper" column. Essentially I have a potentially long list of codes that I want to display in a grid, and I have limited vertical real estate. I would like to show these codes (which are all from the same database column) in multiple columns, maybe 3-5 columns across. ...

Books about Advanced WPF control building

Hello. I'm really interested in learning really advanced features of WPF to learn how to create advanced controls, but apparently I'm running out of resources, and possibly, imagination. I have these 4 books: WPF Control Development Unleashed Experiences Pro WPF 2008 Presentation Professionals Programming WPF Chris Sells WPF in Action...

Query on MVVM design pattern on WPF.

I am using MVVM architecture. I have a usercontrol UC as a View Model is a ModelData class ViewModel (UCViewModel) is binded to a usercontrol. I have three more usercontrols that is inside the usercontrol UC ( discussed above). Let's say uc1, uc2 and uc3. and the visibility of uc1 , uc2 and uc3 inside UC depends on the type select...

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...

WPF User Control is causing Out of Memory Exception

Looking for a free spell checking solution, I thought I was so smart in doing this but I guess not. I have created a windows form based application and I want the form to add a user specified amount of user controls (with textboxes) on to a panel. The user can then click some button and the controls on this panel are cleared and new one...

What is the difference between DataTemplate and DataContext in WPF?

I can set the relationship between View Model and view through following DataContext syntax: <UserControl.DataContext> <view_model:MainMenuModel /> </UserControl.DataContext> And I can also set the relationship between View Model and view through following DataTemplate syntax: <DataTemplate DataType="{x:Type viewMode...

How do I inject dependencies to user controls in WPF

What is the best way to transparently inject dependencies (using IOC container) to user controls in WPF? I assume that user controls are part of XAML for the window or other user controls. Also I think parent (whoever it is) should not be responsible for this. Solution for manually injecting dependencies from parent looks not clean enou...

WPF : How can I sendkeys to another control without taking focus away from the target control

I've followed this question and it works well, but it takes away focus from my sending control. What I'm trying to do is to create an entry box that works like an auto complete text box - a text box and a popup control that contains the list of matching items. I need to be able to take keys, such as Up,Down and route them to the popup...

Lighter-weight elements - how does one gauge/know the weight of an element?

I'm working on the UI side of a WPF project. My favourite reference while xaml'ing (besides stackoverflow :) ) at the moment is Adam Nathan's "Windows Presentation Foundation Unleashed". He gives the following tip regarding control templates: "Rather than using a ContentControl inside a control template, you should use the lighter-weight...

Context Menu for textbox

Hi All, What exactly I want to do is that there are 2 tables,ie, user and userprofile and both of them have almost identical fields. I shall take example of the email field. There is a textbox and the User table email field value is displayed in it. What I want to do is, have a context menu such that when the user right clicks on the...

Question on MVVM pattern on WPF ?

I have a user control let say UC1 . This user control have viewmodel UC1_vm. In the usercontrol UC1 I have a canvas in which drawing curve logic is implemented. This drawing curve logic is based on the data points property in the view model ( UC1_vm). The data points property inside the view model change with different condition. The...

How to set the font of child control inside the group box?

When I set different font to Group box the child controls also set to the font of group box. I have to set each child control with different font property. Like I have to set child control Font property to <GroupBox Font Size = "14"> <Label FontWeight"Normal" ,Font Size ="8"/> <TextBox FontWeight"Normal" ,Font Size ="8"/> </GroupBox...

Drag and Drop Expander in WPF

I have a Expander as a ListBoxItem , I want to to add support for drag and drop the Expander item with in the Listbox. I found some nice tutorial from the following location. http://psiman.wordpress.com/2006/12/07/reordereablelistbox/ i implemented this in my project, but the problem is i am able to drag and drop only when the Expand...

WPF - Make two controls the same size

Is there any way to make two controls that are in different containers the same size in WPF? For example, suppose you have two textboxes: textbox1 and textbox2. Textbox1 is in a grid and its size can grow and shrink when the user resizes the window. Textbox2 is in another part of the window and I need it to always have the same size a...

how I can print WPF treeview items over multiple pages?

Hello friend, I want to print tree structure showing in WPF treeview control in multiple page. I tried PrintVisual() but it only prints only visible parts. Then I tried FlowDocument and written AddNode(), but its not showing the same result as treeview doimg. Please help me with code. public void AddNodes(int uid, ListItem tSubNode) ...

wpf prevent second click button

hi! I have a problem again. when I click button, window appears. when I click button again same window appears again. I want when I click button first time, page appears. but I want to prevent second click. can anyone help me with this problem? thanks in advance. private void Dictionary_Click(object sender, RoutedEventArgs e) { Dictio...