wpf-controls

Can I create a navigation control like this example in WPF using a TreeView?

I want to create a WPF control similar to the example below. Check out the link and look at the navigation control on the left. Can this be done in a treeview? If so, any idea how I would start? If not a treeview, then how could I achieve the same thing? Navigation example The parent node has a different style to the child node and i...

Passing WPF user control selection to host control

I have a WPF user control with a list box. I want to pass the selected item in the list box to the calling control thru binding. How to achieve this? Appreciate your help! ...

How to determine visible region of clipped WPF control?

Hi, is there any way to determine the visible region of a WPF control that is clipped by parent controls (e.g. ScrollViewer, Canvas, or panes)? Background of my question: we are using the WebBrowser control in our application. Since it is derived from HwndHost, parent controls cannot clip it, i.e. it will overlap parent controls, whic...

WPF Slider AutoToolTip visible on hover

By default the AutoToolTip only shows up when the users click the thumb, but I want to be able to show it as soon as the mouse is over the thumb (without clicking). Is this possible? ...

How do I add type-down support to a WPF ComboBox?

This is my ComboBox: <ComboBox Name="ApplicationList" MinWidth="200" Margin="4" > <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding ApplicationName}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox...

Concatenate styles in SL 4 / WPF?

Hello, How can I use several styles on a control? For example, I have a style that defines the size and margins for buttons, and several styles that define different color schemes. I would like to use the sizing style and a colors style on one control. Any hints are appreciated... Thanks. ...

WPF window template resource

Hi guys! I am trying to define a window template that can be used by windows in other assemblies. I define a window template and store it in resource dictionary in some assembly. After, I use this template in other assembly on window definition in XAML. It looks that the template is accepted and I can see updated window in VS-2010 design...

Wpf element host flickering issue

Hi folks, I have an element host with one WPF control (with only a texblock in it for ex) on winform. When my application loads, the hosted control is taking few seconds and it shows a white background for few secs and after only it gets loaded t. Is there any way to avoid this.. Any ideas are appreciated. I'm using Microsoft visua...

WPF events, commands or using both

Hello, I am constructing my app infra structure, and finding it hard to achieve a very basic behavior - I want to raise events from different user controls in the system and being able to catch those events on some other user controls that listens to them. For example i have a user control that implements a TreeView. I have another user ...

WPF TextBox autogrow

I have a TextBox with a height=15 and width=50. I want the textbox to grow when the text size exceeds 50. I want to achieve this without using Width="Auto". Is there any way to achieve this? I tried TextWrapping = TextWrapping.Wrap without any success. Appreciate your help!! ...

WPF: Override style for RichTextBox

How do I make a disabled RichTextbox with a transparent background? I'd like to use the RichTextBox to display some rich text but make it disabled, so the text can't be edited. I want the background to be transparent while it's disabled, but the default behavior is to make the background greyed when the control is disabled. I've exper...

Get the Thumb of a Slider

Hi, I'm just trying to figure out a way to get the thumb of a slider in WPF, something like so: Slider mySlider = new Slider(); Thumb thumb = slider.Thumb; Now I konw it's not possible as simple as this; but there must be a work around this. Let me know if you know any. Thanks! EDIT: Btw, I blogged my problem and solution: http:/...

How to add a key board shot cut in wpf for raising the click event of button.

I have a wpf user control which has some textBlocks and two button. I can add control in any wpf windows at run time and can register button event in that window., that is working fine. Now i want to access button click event by some keyboard shot cut. ...

WPF Control Trigger applied to DATETIME of datagrid

I was looking to colour the rows of my datagrid as per a datetime column to which is populated by an ObjectDataProvider, my question is whether this is possible within XAML? Mashed up some sample code of what I'd like, a datetime comparison based on one of the , then colour that row as applicable. <Style.Triggers> <Trigger Propert...

WPF c# Subscribe/Publish events mechanism using reflection - right or wrong?

I want to achieve a simple Subscribe/Publish mechanism within a WPF application so i can subscribe to events from different places in the application specifying the event type and handler method, and then when publishing the event, my mechanism will call all the subscribed methods on the subscribers. I cannot use the RoutedEvent as I wan...

In wpf, is there a way to execute code before the control is unloaded...? like maybe an unloading event?

Hi, I need to execute code before a wpf user control is unloaded and cancel the unloading if certain conditions are met and keep the control open in its current state in the ui... Is there any way I can accomplish this? I couldnt see anything like unloading event? Thanks, ...

When will the CanExcute event be raised by the CommandSource

Hi, When will the CanExecute event be ideally raised by the control that realizes the ICommandSource interface?? I tried to add a breakpoint to the handler to check when it is getting raised and it seems to be executed whenever the control is rendered on the screen. Can someone explain when exactly it will be raised and how to raise ...

How to access WPF datagrid Template Column ????

Hello Experts, I'm using WPF 4.0... I created a custom control like decimal textbox... I had inserted that decimal textbox in datagrid template column... Now my problem is that, How to access that template column or that decimal textbox in Code behind( C#)???? Thanks in Advance ...

How to exchange window content dynamically in WPF

Hey everybody! I need help on developing a WPF UI. I'm new to WPF. So far I read many tutorials and decided to follow a MVVM design pattern. What I want to accomplish might seem simple: There is a ComboBox at the beginning of a window. It's embedded in a Grid with two rows. Now I want the content of the second row to depend on the sele...

WPF Treeview HierarchicalDataTemplate MTM Relation

I am trying to map a TreeView to a collection using the HierarchicalDataTemplate. The collection contains an Object that contains child entities of itself(Many To Many Relation), and then goes down to another object using regular one to many relation. I use the followings: <HierarchicalDataTemplate DataType="{x:Type src:Organization}" I...