wpf

WPF: access controls from usercontrol

Hello! I have a usercontrol whit a RichTextBox control and a TreeView, and I want to bind a commands like Copy, Cut, Paste etc which are in Window not in usercontrol but I dont know how to access Elements from usercontrol? Any ideas? ...

Creating the ListView in WPF ?

Hi guys and happy new year(2010). I'm a kind of novice in WPF's ListView. I'm gonna create the following ListView in WPF via XAML and C# : http://xs.to/image-A835_4B3EF7EE.jpg Could you please guide me , how I can do it ? Thanks. ...

wpf: capturing mouse does not work

hello I am developing an kind of outlook calendar application where I need to make the appointment resizable from mouse. My first try with a thumb did not work properly so I tried another way. What I did is that: 1) on the botton of the appointmennt panel I added a rectangle to figure out the resize zone (the thumb). The appointment p...

WPF: How to correctly implement a modal dialog on top a non-modal dialog?

In a WPF application I would like to implement the following behaviour which doesn't seem to work straightforward: From the main window (Window1) the user opens a non-modal window (Window2), and that non-modal window may display a modal dialog (Window3). The problem is that whenever the modal dialog has been shown, the main window disa...

Applying MVVM to an ItemsControl populated with UserControls

As I knock off more and more MVVM-related issues with my current application, more just keep popping up. :) The current implementation that I am trying to replace involves a StackPanel whose children are more or less dynamically generated (via looking in a configuration file). Each child is an instance of a UserControl. Before, what ...

How to move a Shape on Canvas in WPF ?

Hi, I added a Rectangle to a Canvas like this: Canvas.SetTop(myRectangle, 150); Canvas.SetLeft(myRectangle, 80); canvas.Children.Add(myRectangle); Now I want to move the rectangle to other place, say (100, 100). What is the best way to do this ? Thanks ! ...

Dynamic filter of WPF combobox based on text input

I cant seem to find a direct method for implementing filtering of text input into a list of items in a WPF combobox. By setting IsTextSearchEnabled to true, the comboBox dropdown will jump to whatever the first matching item is. What I need is for the list to be filtered to whatever matches the text string (e.g. If I focus on my combobo...

Hit Testing in WPF

Hi, I have an Ellipse on a Canvas and I'm doing a Hit Testing on it. Every time I click the stroke of the Ellipse, the test pass. If I click in the middle of the Ellipse, the test fails. This is good ! After I fill the ellipse like this: myEllipse.Fill = new SolidColorBrush(Colors.Blue); the test pass also when I click in the middle of t...

Using custom dependency properties as DataTrigger in WPF

I have a custom dependency property that I would like to use as a data trigger. Here is the code behind: public static readonly DependencyProperty BioinsulatorScannedProperty = DependencyProperty.Register( "BioinsulatorScanned", typeof(bool), typeof(DisposablesDisplay), new FrameworkPropertyMetadat...

How do I databind to children of a child object?

Below is a sample of my object as XML. I had to take out the actual data because of Privacy, but you should get the gist of things. Currently I have binding working pretty well, but I cant get a box to fill with the necessary Granchild information. The list box is working correctly, and its probably a logical issue on my end that I am ju...

Is it possible to bind two source properties to one control property?

Using WPF, is it possible to bind two source properties, via one-way binding, to one control property (ie textbox.text)?? I'd like to have the user input a value in a textbox and have that value pushed to two different properties in the source datacontext. My workaround is to create a dummy property and have the setter set the two valu...

WPF ListView Data Binding?

I have a collection of objects that I wish to bind to a ListView control. In some of the objects, the value of a property that will be displayed in a column in the ListView is an empty string (""). I want to replace the empty string ("") with "n/a" automatically using binding. How can I accomplish this? ...

Drop outside the control

I'm improving standart WPF TabControl. I want to add undocking functionality to it: user drags the page just outside the TabControl and this page undocks in the window. I want two events in this control - PageDragStart (raises when the page dragged outside) and PageDragEnd (raises when the page dropped outside) I've got no problem with ...

Positioning adorner relative to parent's dimensions in WPF

Hi, I am trying to position an Adorner depending on the dimensions of the parent of the adorned element. For example, I have a textbox. I want to adorn this textbox so it looks something like this: A textbox is placed in a canvas object and if there is enough space available then place the adorner (semi transparent rounded square) i...

Simple WPF Custom Control - How to set background color?

I've created the simplest possible WPF control - It just overrides OnRender and draws a red rectangle. However ONLY when setting the Background in XAML to Blue, the control is all blue with no red showing. If Background is not set, the red rectangle shows no problem. How come the red rectangle is not displayed over the blue backgrou...

How do you bind the DataContext of a Control to the DataContext of its Content in WPF?

I tried this: Binding binding = new Binding("Content.DataContext"); BindingOperations.SetBinding(tab, DataContextProperty, binding); It isn't working. I don't know why. ...

How to find a child from the styled listbox in WPF?

Hi, Listbox has the style in which itemtemplate consists of expander and inside expander there is a one more listbox, listbox inside the expander has to be accessed. So how to go ahead? ...

How to iterate through set of custom control objects in WPF?

In a window of my WPF application I have a number of objects which dirived from a custom control: ... <MyNamespace:MyCustControl x:Name="x4y3" /> <MyNamespace:MyCustControl x:Name="x4y4" /> <MyNamespace:MyCustControl x:Name="x4y5" /> <MyNamespace:MyCustControl x:Name="x4y6" /> <MyNamespace:MyCustControl x:Name="x4y7" /> ... In my code...

Layout Listbox/Menu items in an arc shape..

Hey..I am trying to layout some menu items in an arc shape.I am trying some samples but couldn't get hold upto now.u can find an implementation at http://www.mscui.net/PatientJourneyDemonstrator/PrimaryCare.htm Hover your mouse to the top and select 2.Patient Record.In that screen there is a menu,Which is very nice.I am looking for tha...

How do I get ListBox, Canvas and Thumb to work together?

How do I get ListBox, Canvas and Thumb to work together? I am attempting to reuse the selection logic of ListBox together with a Canvas that contains draggable Thumbs. Unfortunately the Thumb appears to handle the mouse events so that clicking on the Thumb doesn't make the item selected. I was hoping these elements could be made to wo...