wpf

Is there a way in the WPF Toolkit datagrid to have a header below the column headers but above the first row

Hi, I looking for a way to create an area that indicates a user is at the top row of the WPF Toolkit datagrid. (Showing the scrollbar scrolled down is not enough for the user). I need something that sticks out and says "this is the top row" basically. Messing with the entities that that the grid is bound to will not work for me becaus...

.NET get selected text position cordinates from another window

Hello, I have .NET WPF application, that sits in background, and responds to user selecting text for example in Microsoft Word. After user selects text I need to draw window next to selected text. My question is: How it is possible to get selected text coordinates in currently active application? As I understand it has to do with Int...

c#: How to pass linq-objects around

When showing my main window, I make a list of objects from linq-to-sql: using (var context = new Data.TVShowDataContext()) { Shows = new ObservableCollection<Data.Show>(context.Shows); listShows.ItemsSource = Shows; } Now, when I doubleclick an item in my list, I want to use the selected object in a new usercontrol: Sho...

Using a resource image in code behind

I need to dynamically change the background image applied to one of my buttons, but can't figure out how. The images are added to the project and have their Build Action set to Resource. I've tried the follow: buttonUnits.Background = new ImageBrush(new BitmapImage(new Uri("/Images/InchDOWN.png",UriKind.Relative))); This compiles succ...

WPF - Error cleaning solution - Local Storyboard

Hi, I've ran into this problem I can't quite wrap my head around. I've got this WPF Application which seems to be just fine when I open in Expression Blend. It compiles and I can even rebuild the solution with no problems and no error message. But when I go to Clean Solution, I get this error: The name "SplitExpander" does not exi...

Binding ObjectDataProvider to a property instead of a method.

Suppose you have following class: class ProcessController { public List<Process> Active { get { ... } } ... public List<Process> GetProcesses() { ... } } I can use the GetMethod to bind a ObjectDataProvider to the GetProcesses() method: <ObjectDataProvider x:Key="pList" MethodName="GetProcesses" ...

WPF Adding textblock on an item and binding it to a textbox

I have a diagram designer program and I want to add texts to shapes (these are path objects) when user right clicks to a shape and writes shape name in the property window. I add a context menu property to shapes and when user clicks to "properties" in the context menu, a new window opens that has a textbox and a button. I can add a text...

Where can you download Managed JScript for the DLR?

The lastest release (0.9 Stable) of the Dynamic Language Runtime contains IronPython and IronRuby, but it doesn't contain Managed JScript. Does anyone know where I can download the latest release of Managed JScript for use with ASP.NET and/or WPF? In case you aren't aware, JScript.NET and Managed JScript are too different things. What ...

WPF bind control size

I have a StackPanel with a list of custom user controlls that I would like to resize. I would like the user to be able to drag a slider and scale the control size up and down. Is there a way to bind the control width to a slider value? Something similar to: <MyControl Width="{Binding Path=SizeSlider.SelectedValue}"/> Is this possible...

Trouble with SetTop in Silverlight WPF app

I am not able to use SetTop property Canvas in Silverlight App. Following is the minimal code to reproduce the problem from System import TimeSpan from System.Windows import Application, Duration, PropertyPath from System.Windows.Controls import Canvas, TextBlock from System.Windows.Media import SolidColorBrush, Colors from System.Windo...

How to propagate errors & exceptions that occur during WPF data binding?

Every so often I find that I have accidentally broken data binding in my application. Either by renaming a property and not renaming it in the XAML or by a property throwing an exception for some reason. By default data binding errors are logged to debug output and exceptions that are thrown are caught and suppressed. Is there an easy...

UserControl vs SurfaceWindow

Hi, I am trying to use values i declare inside a UserControl class to change things inside the SurfaceWindow class. Now what i know so far is that i have to use a DependencyProperty to get the value from the UserControl and then put it inside a public string. public string MapValue { get { return (string)GetValue(MapValue...

How is DataContext inherited in Views which contain Views?

I'm rebuilding Josh Smith's WPF CommandSink example and there are a few things that I don't understand about his databinding, especially about how datacontext is inherited when a view is contained in another view which is contained in a window which has a datacontext. all databinding is declared in the XAML files, there is absolutely n...

How can I make this Xaml a Template?

Without using code, how can I turn this into a Template? I have about 10 of these, and my code is getting huge. It is working perfectly, I am just looking for ways to clean up the code, I am just not familiar enough with templating and resourcing animations and triggers to do this. Thanks in advance. <RadioButton Width="35" Height="3...

Why is this XAML getting the error: Items collection must be empty before using ItemsSource

Can anyone conjure from this code why the ItemsSource line would be getting a Items collection must be empty before using ItemsSource. error? Most solutions I've found point to ill-composed XAML, e.g. an extra element etc. which I don't seem to have. When I take out ItemsSource="{Binding Customers}" it runs without an erro...

Merged ObservableCollection

Hello, I have two ObservableCollections and I need to show them in one ListView control together. For this purpose I created MergedCollection which presents these two collections as one ObservableCollection. This way I can set the ListView.ItemsSource to my merged collection and both collections are listed. Adding works fine but when I ...

WPF visual display VS Adobe Director

Hi, We are having a small argument... There is a old dev team here that produced a kiosk application using Adobe Director technology. Few months ago there was a decision to migrate the application to the new WPF technology. A new dev team was originated, and in these days we are able to see the flow of the new WPF application. The f...

What's wrong with this image panning algorithm?

In response to this question about zooming and panning in WPF I made the suggestion to use a ScaleTransform and update the RenderTransform origin in the MouseMove event. This works but I'm not happy with the fact that the panning movement does not quite match the mouse. I can see what the problem with this algorithm is, but the correct i...

Getting "Cannot set Visibility or call Show or ShowDialog after window has closed." After main window .ctor and Loaded

Hey Everyone, I've run into a bit of a nutty issue. For this Window: <Window x:Class="Host.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStyle="ToolWindow" Top="-5000" Left="-5000" Width="0" Height="0" ShowInTask...

How does one go about debugging databinding issues in MVVM?

I have rebuilt Josh Smith's CommandSink example from scratch and my version runs without error except that my command buttons are grayed out. I assume this is because there is something somewhere not set correctly so that the commands never get set to CanExecute = true or at some point get set to CanExecute = false. But since the databi...