wpf

creating a .NET custom control

I want to create a control which is basically a ListBox, but each ListItem is a collection of controls. So each item of that list box is a combination of a Label, a CheckBox, a Timer and a TextBox. Can this be done with the .NET framework? If so, do you have any recommendations on how to get started, any links to samples or discussion,...

Data Template not injected in ItemContainer

I have an ItemsControl class that overrides the following methods protected override bool IsItemItsOwnContainerOverride(object item) { return item is TilePanelItem; } protected override DependencyObject GetContainerForItemOverride() { return new TilePanelItem(); } I provided the template for TilePa...

How can we assume a bool Property on a Generic<T> class , where T is a auto generated LINQ2SQL class

I am doing a CRUD operation on Database generated class(using LINQ2SQL) in my WPF application. All of my DB tables have IsDelete property exists. So I want to define an abstract/interface class to do the SoftDelete(). My question here is, how can I define my Generic class in such a way as to access T.IsDelete = true ? or in code I want t...

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 Datagrid, Setting the background of combox popup

Hi, I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I've edited the Template for a normal Combobox and it works great for selected item and other properties but the background stays white. I've used Snoop to do some research into the template and it claims that the...

Where is DataGrid RowDeleted event??

Hello I am looking for an event I can handle for row deletion. ...

Capturing a window with WPF

With Windows Presentation Foundation, if I have an HWND, how can I capture it's window as an image that I can manipulate and display? ...

WPF DataGrid style Silverlight DataGrid?

That's not a secret: Silverlight's DataGrid default style is beautiful while WPF's is poor. Instead of reinventing the wheel let me ask the community if anyone has copied the SL styles to use in WPF. Silverlight default-style DataGrid: WPF default-style DataGrid (updated after Saied K's answer): ...

WPF Image won't display BitmapSource

I'm new to using WPF and GDI, and I'm having trouble displaying an image. My eventual goal is to build something expose-like. So far, I gray-out the screens, gather all the active HWNDs, and capture the screens of all the windows. For now, I have a single Image element that I try to set the source for, but nothing ever shows up. foreach...

DataGridTextColumn.MaxLength?

How do I set the MaxLength property of the DataGridTextColumn? ...

How to determine index of current ListBox item from DataTemplate?

I have a ListBox. Now I want to write a DataTemplate in such way, that the first item will have red background and white background for other items. I guess I need to write a DataTrigger, but I have no idea how do determine that DataTemplate is applying to the first item. ...

Connecting two WPF canvas elements by a line, without using anchors?

I have a canvas for diagramming, and want to join nodes in the diagram by directed lines (arrow ends). I tried the anchor approach, where lines only attach at specific points on the nodes but that did not work for me, it looked like crap. I simply want a line from the centre of each object to the other, and stop the line at the nodes' e...

Binding window title to child property

I've got a window with my custom textbox-like control on it <Window.Title> <Binding ElementName="codeBox" Path="Filename" UpdateSourceTrigger="PropertyChanged" /> </Window.Title> ... <custom:CodeArea Name="codeBox"> </custom:CodeArea> here what I have inside my CodeArea back code (CodeArea.xaml.cs) private string _filename = "NoN...

WPF control-template: why specify a Grid with no ColumnDefinations/RowDefinations as the outter element?

Hi, I've been reading Programming WPF, here is one of the examples about Control Template: <Button DockPanel.Dock="Bottom" x:Name="addButton" Content="Add"> <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Ellipse Width="128" Height="32" Fill="Yellow" Stroke="Black" /> ...

WPF Form Toolbar Short cut keys in Outlook 2003 VSTO addin

Hi, I am working on a outlook 2003 addin(using VSTO), which launches a wpf window. I have added menus and tool bar on this form and assigned shortcut keys for them.The problem is that these shortcut keys are intercepted by the outlook resulting outlook default action. Example: Alt+f invokes file menu on outlook, instead of menu in wpf ...

Remove alpha from a BitmapSource

Hello, I use BitBlt() and CreateBitmapSourceFromHBitmap() to capture a window as a BitmapSource that I can display on an Image element in a WPF application. But for some reason, most of the application that it captures is transparent. Here is a source vs. capture image of what's happening: It's gray because the background of the wind...

WPF: TreeView and nested templates

I'm trying to display a class using a treeview but nothing is displayed. I've inspected the container with Snoop and I see the StackPanel, but it's empty, even the the project does have a title and pages. There are no binding errors and I have no idea why it's not working. public class Project : INotifyPropertyChanged { public s...

WPF itemscontrol binding to collection of controls

Hi, I'm trying to bind to a collection of controls I generate dynamically: <ItemsControl ItemsSource="{Binding CustomFields}"> And the code: public ObservableCollection<Control> CustomFields { get { return GetCustomFields(); } } The Getcustomfields just generates some controls like a...

Handling selected objects on the GUI in WPF

I've built several user controls in WPF and they all get added to a canvas. I want to add a behaviour that keep tracks of the currently selected usercontrol. A usercontrol should be selected when: The mouse clicks on it; when it recieve focus; when either of the two above happens to a subcontrol of the usercontrol. Is there any way t...

Working with bitmap in WPF

Is there any sane way to work with bitmaps in WPF? I'd like similar functionality as System.Drawing.Bitmap: be able to load image from file and get and set the color of particular pixels. I know about WriteableBitmap, but I don't want to work with Arrays of gods-know-what (I couldn't find that on MSDN), or pointers. I just want to read ...