wpf

Changing the background of a WPF toolbar panel

I'm trying to reproduce a Visual Studio style toolbar with the two gradient backgrounds in C# code. I can see how to do it in XAML, but how do I drill into the object to change the backgound of its 'MainPanelBorder' border in my C# code ? Thanks ...

WPF ListBox Can you make it cycle? IE not hit hard stops at top and bottom

I have a WPF ListBox bound to a data object. Inside the listbox are a series of images with text. It is layed out in a horizontal fashion, and mousing over the left or right sides of the box scroll the items left or right respectively. let's say there are 20 items in the listbox. I'm trying to figure out how when I hit position 19 item ...

wpf update ListViewItem background property

I have a listview that is binded to a ThreadSafeObservableCollection. The background of each of these items is set to an enum that is run through a color converter, here's the code for these 2 settings. <UserControl.Resources> <EncoderView:EncoderStatusToColorConverter x:Key="ColorConverter"/> <Style x:Key="ItemContStyle" Targe...

How to retrieve sender in click handler from toolbartray or other control in wpf?

XAML: <ToolBarTray Name="tlbTray" ButtonBase.Click="tlbTray_Click"> <ToolBar Name="tlbFile"> <Button Name="btnOpen"><Image Source="images\folder.png" Stretch="None" /></Button> <Button Name="btnSave"><Image Source="images\disk.png" Stretch="None" /></Button> </ToolBar> </ToolBarTray> Code: private void tlbTray_Click(object ...

How do I create a user control that can be sized larger than its created size with WPF

I've created a user control using WPF and I want to add it to window. I've done that, but I can't make my control have a height higher than the height it has in its own xaml file. My MaxWidth and MaxHeight are both infinity, but I can't make the control any taller than what it is in its xaml file. To get around this, I have to make all ...

How do you display a Combo Box in a ListView when binding?

I am displaying many rows of data in a list view that is bound to a list of a custom class. The custom class has a property called type. The number of allowable Types is limited and I would like to limit the user to making changes by selecting from a combobox. I tried adding a combobox to the base class but that did not display as a c...

How to build a simple source code editor using WPF ?

Hello there and Merry Christmas !!! I am new to WPF and I am trying to build a text editor for a assembly language. The assembler provides me a two lists: a list of errors a list of warnings My editor should have the ability to inport the contents of a file and display it in a text-panel. I want it to be similar to Visual Studio. L...

WPF - DispatcherUnhandledException does not seem to work

Hi I started a new WPF project in VS2008 and then add code to trap DispatcherUnhandledException. Then I add throw an exception to Window1 but the error is not trapped by the handler. Why????? public App() { this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledExceptio...

WPF design question involving treeview

I have a hierarchy that looks like this - Factory>machines>components>controls where ">" can be read as "contains a list of". This fits very nicely into a TreeView using HierarchicalDataTemplates. Now say I want to add checkboxes to the tree, so that the user can create "views" of the tree that require controlling. Currently my templat...

How do you know if your WPF control is being rendered?

I have 2 tab items. In tab No.1 I have a control which corresponds to window resize event and need to call PointToScreen(). The problem is Tab no 2 is active and I resize the window, the control in tab no.1 reacts and fail because its' visual is not being rendered and I get "This Visual is not connected to a PresentationSource" exceptio...

How Do I get this ComboBox Hosted in a ListView to update my Collection?

I have a ComboBox hosted in a ListView and I need changes in the CombBox to update the supporing class that the ListView is bound to. Here is my DataTemplate <DataTemplate x:Key="Category"> <ComboBox IsSynchronizedWithCurrentItem="False" Style="{StaticResource DropDown}" ItemsSource="{Binding Source={...

Dependency Properties with Explicit Interfaces

Hi all, I am knocking together a WPF demo for our department at work to show them the advantages of WPF whilst trying to adhere to our development standards (dependency injection and developing objects to an explicit interface). I have come to a bit of a wall now. I am implementing the View using the MVVM design pattern and I need to u...

Is there a WPF ListBox equivalent to Windows Forms Listbox TopIndex?

Basically what I want to do is allow a user to type in a string value and have the list box scroll to the item that matches the text they have typed (or the first LIKE match). If I use the .ScrollIntoView() method, the problem is that it puts the item at teh bottom of the visible area if the item is further down in the list than the cur...

WPF animation slow when the mouse is in the window

I'm trying create a moving rectangle (rect). This is the relevant code: let timer = new Threading.DispatcherTimer(); timer.Tick.Add(fun _ -> Canvas.SetLeft(rect, Canvas.GetLeft(rect)+0.01) |> ignore) timer.Start() The problem is that the animation is slower if I move the mouse over the window. If I set the timer's interval: timer.Int...

WPF changing button background color when the window is disabled

I have a button with a transparent background on a wpf window. Problem is, when I open up another window with a .showdialog the form becomes disabled as does the button, causing the button to go white (and stick out like a sore thumb); the same happens to the listview and textbox controls. Labels and group boxes aren't impacted in this...

Share Translation and business entities between applications

I'm creating an application that has both an ASP.net version, and a WPF version. I'm sharing the business logic and entities between them so the only thing I should have to maintain 2 of will be the UI. For the most part this is pretty straight forward. there are some instances where the methodology has to change, just based on the nat...

Add Checkboxes to VB.NET WPF 3.5 TreeView

Is it possible to add checkboxes to the WPF TreeView object? I'd like to have someone be able to check a specific entry for data retrieval at a later time. Thanks for the help in advance! JFV ...

Space-filling ToolBar item in WPF.

How can I make an item inside a ToolBar fill all the remaining available space? Or, how to right-align some items, since that would give me the same effect in my case. Note that solutions which involve nesting another container (like a Grid) inside the ToolBar don't work since that disables the special behaviour ToolBar gives to it's it...

Anyone know a code editor I can embed in a WPF window or Windows forms?

Hi I want create my own IDE but I want a code editor that would syntax highlighting. I want to embed it as a control into a WPF window. Malcolm ...

WPF: How to specify units in Dialog Units?

i'm trying to figure out how to layout a simple dialog in WPF using the proper dialog units (DLUs). i spent about two hours dimensioning this sample dialog box from Windows Vista with the various dlu measurements. Can someone please give the corresponding XAML markup that generates this dialog box? (Image Link) Now admittedly i know...