wpf-controls

User Control inherit from ListBox in Wpf?

Hi. I want to make a user Control in WPf with same properties and events like ListBox.(can add items , remove them , selecting ,...) on way in windows App is use a user control which is inherit form ListBox. but in WPF I don't know how make User Control inherit from ListBox (or other WPF Control)!!! I write this code but it had an exc...

Cleanup for control inside a FlowDocument

I have a custom control that I use inside a FlowDocument. The control uses a System.Drawing.ImageAnimator to display transparent, animated GIF images. Why is this such a pain in the butt in WPF anyway? :P In my original implementation, this was causing memory leaks when a paragraph containing the control was being deleted from the docum...

WPF TextBlock binding with <LineBreak/>

I have a TextBlock binding as follows in my ControlTemplate. <TextBlock Grid.Column="1" VerticalAlignment="Center" FontSize="16" FontFamily="Arial" FontWeight="Bold" Text="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ButtonText}"> </TextBlock> When I set ButtonText as follows with , it doesn't work. It doesn't displ...

WPF Copy / Paste functionality

Hi all , I want to supply copy funtionality to my WPF app. I display texts in textblocks whitch comes from the server . The user cann't copy this texts and use them. How can do it ? Please you help. Thanks... ...

Textbox value changed

Hi All, Is it possible to know if any of the textbox values have changed in the application. I have around 30 textboxes and I want to run a part of code only if, any of the textboxes value has changed out of the 30. Is there a way I can know that. ...

WPF Checkbox like StackOverflow's "accepted answer" checkbox

I'd like to create a customized checkbox that behaves exactly like StackOverflow's "accept answer" checkbox: That is, I simply want to display a single image when checked, and a single different image when unchecked. I don't care about indeterminate state. I'm a bit of a newbie when it comes to WPF ControlTemplates, so I'm...

Button ControlTemplate and rounded corners

I have a controltemplate for buttons. I want to make the buttons with rounded corners. How should I do this? I tried CornerRadius for button in the Border but it doesn't work. The background of the button has set to an image that has corner borders and the button looks akward as I can't set the corners for the button. <Style TargetTy...

WPF - Translate a point relative to MainWindow to it's coordinates relative to a child control

Is it possible to translate a point relative to MainWindow to be relative to one of its child controls? For example, say a control's upper left corner was located at 500, 500 relative to MainWindow what code would convert that number to (0, 0)? I'd like the solution to be agnostic of the layout mechanism (i.e. not require me to parent ...

What is the WPF equivilant for the FlowLayoutPanel?

I am working on a WPF application (a one note clone which is called "note your life") where you can dynamically assign Tags to an entry (just as in virtually any web 2.0 app these days). for this I had in my windows forms prototype a FlowLayoutPanel that did the job very well. I want to have the tags float to the next line if there isn't...

WPF Focus In Tab Control Content When New Tab is Created

I've done a lot of searching on SO and google around this problem, but can't seem to find anything else to try. I have a MainView (window) that contains a tab control. The tab control binds to an ObservableCollection of ChildViews (user controls). The MainView's ViewModel has a method that allows adding to the collection of ChildViews, ...

Remove Specific Type of Children from Grid Control

I wan to remove suppose control whose type is of border, from the grid control. how can I achieve it in WPF C# ? Sorry Guys, My problem is that I have grid control which has GUI design at XAML end and user control which are added using C# and the some control are overlapped.some controls are removed but some are left wich are come one a...

Best approch for creating Base control

Hi, I am looking for a solution for this scenario - I need to implement a feature to allow user to add various controls to canvas(WPF, custom and third party ) and then select any one of them and modify some properties in property grid(changes needs to be reflected in UI). I don't want to expose all the properties of any control only ...

WPF: Cancel a user selection in a databound ListBox?

How do I cancel a user selection in a databound WPF ListBox? The source property is set correctly, but the ListBox selection is out of sync. I have an MVVM app that needs to cancel a user selection in a WPF ListBox if certain validation conditions fail. Validation is triggered by a selection in the ListBox, rather than by a Submit butto...

Issue with mouse move event

I have a WPF control1 (has a moving control) that is hosted through elementhost on a windows form. My aim is to capture the mouse move events for the elementhost. I found out from the following link that MouseMove fires when Control moves under mouse while mouse stands still. http://social.msdn.microsoft.com/Forums/en/wpf/thread/56e...

How to traverse the item in the collection in a List or Observable collection?

I have a collection that is binded to my Listview. I have provided options to user to "move up" "move down" the selected item in the list view. I have binded the selected item of the listview to my viewmodel, hence I get the item in the collection on which user want to do the operation. I have attached "move up" "move down" commands in...

How to explicitly select the row in ListView in WPF?

I have a ListView in which one of the column contains combo box. I have binded the selectedItem of a Listview, so that I get the current object (selected row ) in the listview. When I do any operation in a combo box like selection change then the listview row ( in which that combo box belongs) is not selected be default and hence my ...

How to assign keyboard shortcuts to WPF Ribbon control?

Is it possible to have keyboard shourtcuts for Application Button in WPF Ribbon control? ...

Loading XAML To Grid Control

How can I load XAML which is from the DataBase into the grid control in C#, How can I load that xaml into Grid Control ? ...

WPF Grid : GridSplitter event

Hi, I need to put a event while resizing grid columns using a gridsplitter. I tried using 'sizeChanged' event on the columns getting affected. But its not working Please tell me how to do that Thanks ...

WPF - Changing an image resource in a datatemplate programmatically

I have a ListBox showing some objects associated each with some files. I also have a ListView of images linked to the listbox's selection. I would like the listview to show an icon corresponding to the filetype (an image for video, image, doc etc...) of each file with the filename below. I can figure out all the code except how to bind t...