wpf-controls

In WPF, why does my Style in Generic.xaml not get applied to my Custom Control?

In WPF, I have a custom control that inherits from TreeView. The code is as follows... public class CustomTRV : TreeView { static CustomTRV() { //Removed this because I want the default TreeView look. //......CustomTRV.DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomTRV), new FrameworkPropertyMetadata(typeo...

ListView.ItemContainerGenerator.ContainerFromItem(item) return null after 20 items

hi first of all, I want to explain what I'm treating to do. I have a ListView in a usercontrol with a DataTemplate define like a resource. I want to hide a button inside the DataTemplate. Sounds easy, but .... the code i'm using is <StackPanel Margin="0" Width="1135"> ...

ContextMenu for some specific text in RichTextBox

In my wpf page i have a RICHTEXTBOX wherein few texts are marked differently(like Fontcolor) for those texts i need to have ContextMenu(along with default copy paste e.t.c) on rightclick. moreover if the richtextbox has 3 marked texts then i need to have Contextmenu with 3 different menu items. How can i implement this?? ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first item to match the letters typed as the selected item The challenge is handling the scenario when the user enters characters that are NOT in...

How to listen for AffectsParentArrange events when you're not the parent

There is an attribute "AffectsParentArrange" that implicitly invalidates the parent's layout - but I want to attach an event handler to the "event" triggered by that attribute. When a child property with the attribute changes, the parent's arrangement is invalidated. I have a custom control (which is not the immediate parent) that need...

Limitations of using .NET 2.0 (Windows Forms) controls in WPF?

I want to start a new application on WPF. The new User interface in WPF needs DataGridView control and PropertyGrid Control. But it looks like that these two controls won't exist in WPF and I want to host these two controls using WindowsFormsHost. However, if I do that, is there any limitation anybody forsee with this approach? ...

What is the best way to move an image or bitmap fast across the screen without trails?

I am using C# and WPF. Currently and simply I load a bitmap in the Image control and then use Canvas.SetLeft and Canvas.SetTop to reposition image. Is there a way to get better performance? Thank you in advance. Cheers! ...

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

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

Unable to set DataGridColumn's ToolTip

I tried the following: <tk:DataGridTextColumn Header="Item" Binding="{Binding Item.Title}" ToolTipService.ToolTip="{Binding Item.Description}" /> And I don't see any tool tip. Any ideas? Is it even implemented? ...

Wpf control size to content?

How do I make a WPF control to change its size according the content in it? ...

Grid Splitter problem in WPF

I want a layout like VS 2008. In which I want two columns and second columns is again split into two. I done that in the xaml mentioned below, but the GridSplitter is not visible vertically ( which split two columns). I want both the GridSplitter to resizable. One GridSplitter Resize the Left Hand Pane and Right Hand Pane and another G...

How can I create a button which Rectangle object filled with a color in WPF with C#?

Hi All, How can I create Button control which contains a Rectangle object filled with the color represented by the Colors.Aqua? I have a rectangle Rectangle rectangle = new Rectangle(); rectangle.Fill = new SolidColorBrush(Colors.Aqua); rectangle.Width = 100; rectangle.Height = 50; and I have a button: Button button = new Button()...

notify all subcontrols in WPF with specific attributes

Hi there, how can i inform all subControls in WPF that they shall for example expand? Not every SubControl shall be informed.. only those who can e.g. accept an other element for drop. Perhaps you know another posibilty to let the items change their color when they do accept specific dropContent. Thanks, el ...

WPF UserControl Default Constructor

Hi All, Situation: I have a user control which i am adding to an expander. I have a constructor which takes some params. I also have a default constructor which just calls InitializeComponent. I call the constructor with the params to setup the user control. The user control is then added to the expander. The expander is not expanded...

WPF: Progress bar with indeterminent duration?

In WinForms you could set a progress bar to loop endlessly to indicate that you don't know how long it will take. How would I do that in WPF? ...

Xamly bind WPF Calendar to a date-range?

Is there a way to bind WPF calendar to 2 date fields as a date-range (i.e. start date and end-date) with xaml binding? ...

How do I bind the result of DataTable With WPF Window C# Combobox Under Some Condition

WPF Window C# app VS2008 I have This data Table ID Name Check 1 AB a 2 AA a 3 AC a 4 AD b 5 BA c 6 BB b what iam trying is to bind my ComboBox On Conditions let say i have few Radio Buttons let say 3 radiobutton-a radiobutton-b radiobutton-c what i was doing before was filling the combobox.items.add(...

WPF ItemsControlSorting in TreeView

I have a treeview control which is binded to System files to show it . similar to Windows explorer Treeview . I use items.SortDescription.Add(..,..) for sorting .The same works for sorting other hierarchical data objects . But it doesn't work for treeview , Help me plz? ...

How to create multiline textbox which shows apostrophe before each line

I want a multiline textbox which shows apostrophes before and after each line. So that the textbox looks like: " Hello this " " is a funny " " string test " Or for example: // This is // a muliline // comment. Edit: These special characters must be readonly and if the user copies text from the textbox these characters should not ...