wpf

A DataGrid for WPF with "multiple columns of columns" support

I would like to display data in a way where the entire set of columns is replicated to the right when there are more items to display than would fit into the height of the grid. This would be instead of scrolling down, space to the right is used to display additional rows. For example: The table below has 3 columns but wraps at item #6...

Creating default style for custom control

Hey Im currently creating a custom control (based on the WPF DataGrid). What i would like to do is to set default styling on the datagrid. Currently im setting the Style property which works. But my problem arrises when i create a style to change fx. the background color in the main applications app.xaml. Then all my "default" styling i...

WPF Listview + GridView - View not Updating

I have got a Listview Item with a Gridview Child, bound to a List of Objects. Below the Gridview I have got texboxes to edit the content of the Gridview (bound to the Gridview). I can add new content (which is displayed in the GridView). When i edit content, it is in fact edited (in the object list) but not displayed in the Gridview (the...

WPF- Treeview--How to add child nodes

hi everyone ! i wanna populate treeview from database. i have a table named Topics. 1.topicid 2.topicname 3.parentid i am using access database. can anyone help me? ...

WPF Trigger not null

Hi ! How to trigger an action in WPF when the Property is not null? This is a working solution when is null: <Style.Triggers> <DataTrigger Binding="{Binding}" Value="{x:Null}"> <Setter Property="Background" Value="Yellow" /> </DataTrigger> </Style.Triggers> I know that you cant "turn around" the condition and do what ...

Wpf - Show Textbox ToolTip

This a test message private void btnClick_Click_1(object sender, RoutedEventArgs e) { txtInput.Focus(); ToolTipTest.IsVisible = true; } When the button is clicked the tooltip is shown on the button, I want to simulate putting mouse pointer on the textbox, the toolbox to be shown for the ...

Header not showing up in WPF ListView

I know this must be obvious but I am starting with WPF and I am stuck: I've the following ListView (in the second row of the main grid on the page), content is showing up but the header is not! <ListView Grid.Row="1" Name="container" ItemsSource="{Binding MyCollection}" > <ListView.View> <GridView> <GridViewColumn Wid...

C#/WPF: Get SelectedItem from TreeView?

Hello, Does anyone know how I can get the SelectedItem (not the Header) from a TreeView? Here is my code: <TreeView Name="treeView1" DataContext="{Binding Path=PresentationsViewModel}" Grid.Column="1" > <TreeViewItem IsExpanded="True" Header="Objects-A-List" DisplayMemberPath="Name" ItemsSource="{Bin...

WPF button tunneling OnClick event

I am looking for a tunneling Button.Click event. The ButtonBase.Click event is bubbling and therefore the root can handle the event only after the action that was registered for that button already occurred (too late for what I need). I need the counterpart "preview" event, so that I can handle the event before the event that is registe...

WPF -- it's gotta be easier than I'm making it

I'm having the darndest time figuring this out: say I've got two Button and three TextBlocks. I want either button to trigger a simple Storyboard on ALL TextBlocks. Currently I'm trying to define a generic Textblock style that contains the Storyboard, and then the trigger comes from any Button click. This is the closest I've come but ...

WPF Application Crash (Easy reproduction) - Is it a microsoft BUG??

Issue: Our application crashes when a user type some text into the WPF TextBox. Please help! The easy 3 minutes reproduction appears below Reproduction: Register a WPF TextBox (m_textBox) TextChanged event to the method below private void OnTextChanged(object sender, TextChangedEventArgs e) { // This line of code throws Unhandle...

Invert colors of a WPF Image

I've been searching everywhere, can't find any answer. How could I invert the colors of a BitmapSource or an Image (System.Windows.Controls.Image) from WPF. Thanks ...

WPF -- Animation Question

New to WPF. Simple scenario. Can't figure out the right way to do this. Say I have a single Button. I also have four TextBlocks. I want that one button to trigger an animation (Opacity from 0 to 1) on all of the TextBlocks at the same time. Thanks in advance! ...

Removing event handlers in xaml style?

Hi, Is there a way to remove event handlers in a style that were defined in another style? Here's a contrived example: <Style TargetType="{x:Type TextBox}" x:Key="DefaultTextBoxStyle"> <EventSetter Event="GotFocus" Handler="TextBox_GotFocus"/> <EventSetter Event="LostFocus" Handler="TextBox_LostFocus"/> <EventSetter Event...

Architecture that can be used for Web/Windows/WPF

I need to create an application whose business logic can be used in WEB/WPF apps is there any standard way to do that. I am a Newb to patterns and have been thinking around in the concept of patterns and frameworks. I donot want to reinvent the wheel.:) Any Ideas?. ...

Profiling WPF application

I have a WPF application, that is sometimes freezing for maybe a half minute and then works fine. I am thinking to profile that application. Anybody knows a good tutorial of how to profile WPF application? Or anybody has any idea on finding a way to know when it is freezing? The freezing is not consistent, and not related to any usage pa...

What's the difference between a dependency property and an attached property in WPF?

What's the difference between a (custom) dependency property and an attached property in WPF? What are the uses for each? How do the implementations typically differ? ...

WPF: Weird data-binding issue when using same data source on two controls

So i have a combo box on the main window of my WPF app. I bind a List accessed through a singleton to the ItemSource of the combo box. All is fine. In a child window that the user can open, i have a ListBox bound to the same List in the singleton. The Problem: when i change the selection of the list box in the child window, i can see t...

How to populate the control that is used in the template with default value?

I'm new to wpf. I am writing a calendar control. I defined a default template in Generic.xaml. All the dates are populates in a listbox. Since listbox is defined in the template, I am using FindName() to access the control. The problem is that I can't call the method that populates the listbox in constructor because it's accessing the te...

Restrict editing in RichTextBox

Hi, I was just wondering if there is a way that we disable editing of a specific word in the System.Window.Controls.RichTextBox? For example, I have "Hello This is a test", and I want to disable users to a edit test(which can be anything). I want to them to change whatever they want, but when they want to click or do anything on "test", ...