wpf

Property as parameter? C#

So I've got a whole bunch of options, every different page/tab can have their own local options. We'll have maybe 10-15 pages tabs open tops. I need to implement a way to show the global defaults, weather the all the tabs have consistent values. I'm working on the model/viewmodel portion of a WPF app. I'd love to find a way that is m...

WPF grid layout and cell content margins

Hey guys, I am working on a WPF control whose content is a grid. I am relatively new to WPF so I am wondering if the below is the right way to go about this. I placed two labels in the grid, both in the same column but adjacent rows: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micr...

Binding to ancestors from within a ResourceDictionary

How can I bind to a UserControl's property from within its ResourceDictionary? I want an object I declare in my resources to have the same DataContext as the UserControl it is contained in: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xm...

Is it possible to launch another view using XAML only when button is clicked?

I know that Binding in WPF is a really powerful feature, but I don't know if that is possible. My window is composed of a really simple grid: <Grid Height="593" Width="800" > <Grid.RowDefinitions> <RowDefinition Height="109*" /> <RowDefinition Height="484*" /> </Grid.RowDefinitions> <Grid.Background> ...

Why Does WPF Swallow Databinding Exceptions?

I am in the process of learning WPF, and am puzzled by the fact that databinding exceptions do not cause a runtime/unhandled exception. Can anyone explain the benefits of databinding working in this way? I'm assuming that there are benefits, but so far I don't see any (disclaimer: I am just getting started with databinding). Links to ...

WPF DataGrid cannot Add a row when datasource is empty

CanUserAddRows="True" only 'works' when there's already data in the itemsource of the data grid. If it just so happens that there are no rows in the original list of items, then the datagrid doesn't display a 'placeholder' row for entering new items, even though I've set CanUserAddRows="True". Why?! Thanks in advance, Trindaz ...

Windows 7 theme for WPF?

Is there any way to make a WPF app look like it's running on Windows 7 even if it's running on XP? I'm looking for some kind of theme I can just paste in. I'm aware of the themes project on Codeplex (http://www.codeplex.com/wpfthemes), but it lacks support for DataGrid, which is something I critically need. I was thinking maybe the Windo...

How to bind wpf ComboBox to Linq to SQL Foreign Key Property

I have a Linq to SQL EntitySet with a Foreign Key Relationship between two tables. The tables in question are a Task table (called Issues) and a Departments Table. The foreign key is the department name (Which is guaranteed unique). I am running into an issue in that you cannot change a Linq to SQL FK field if the corresponding data is l...

Silverlight Toolkit DragDrop on WPF

Do Microsoft actually provide a build of Rx / Silverlight Toolkit DragDrop that "just works" on WPF? From what I can tell the Rx DragDrop stuff is only available in the SL Toolkit (not WPF). The SL Toolkit seems to imply you can use it in WPF (various #defines) but gives no further info on how to do it. If I just want the DragDrop stu...

How to build a messaging system in .NET?

Hi, I'd like to write a program where you can have 2 clients that talk to each other in realtime. I've been looking into WCF services and Duplex messaging, data contracts etc but now I'm confused. Basically I see it as: [Client] --- msg --> [Server] --- msg --> [Client] and vica versa. The server will just act as the messenger. Coul...

How do I programatically change a DockPanel in WPF?

Note:By Request, I have added the full code for my XAML and xaml.cs files In WPF, I have created a DockPanel like so: <Window x:Class="RealEditor.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:forms="clr-namespace:System.Windows.Forms;assembly=Sys...

No binding error but still binding does not show anything?

Hello, what do I have to change in my xaml/code to make the binding to the properties => SchoolclassName and LessonName work on both TextBlocks? I get no Binding errors but I do not see anything displayed? <Grid Margin="20" Height="300" Background="AliceBlue"> <ListView ItemsSource="{Binding Timetable}"> <ListView.V...

Treeview MVVM ObservableCollection Updates

I have a treeview which binds to lots of nested ObservableCollections. Each level of the treeview shows an aggregated sum of all the hours in child items. For example: Department 1, 10hrs ├ Team 10, 5hrs │ ├ Mark, 3hrs │ └ Anthony, 2hrs └ Team 11, 5hrs ├ Jason, 2hrs ├ Gary, 2hrs └ Hadley, 1hrs Department ...

WPF TextBox Validation

I have validation hooked up to a model that is bound to the textbox container. When the window is first opened validation errors appear as the model is empty, I do not want to see validation errors until submit of the window or the text in the textbox has changed or on lost focus. Here is the textbox. <TextBox Text="{Binding ...

How to handle a CompositeCollection with CollectionView features?

Is there a way to get notified when CompositeCollection's current location changes? I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed. ...

What is the difference between WPF and Silverlight?

What is the difference between WPF and Silverlight? Is it just the same as winforms vs asp as in desktop apps versus web app or is there an overlap? ...

WPF TabControl - how to preserve control state within tab items (MVVM pattern)

I am a newcomer to WPF, attempting to build a project that follows the recommendations of Josh Smith's excellent article describing The Model-View-ViewModel Design Pattern. Using Josh's sample code as a base, I have created a simple application that contains a number of "workspaces", each represented by a tab in a TabControl. In my appl...

Is it possible to assign ToolTip text (containing non-latin characters) in a Control Template of a WPF custom control?

In a WPF app I have a custom control. I would like the ToolTip for objects, derived from this custom control, depends on a value of one of the attributes of this custom control. Is it possible to declare it in a Control Template of this custom control? Something like: <ControlTemplate> ??? // <!--XAML ToolTip declaration --> ... <Con...

WPF: Adding an image to a ListBox ItemTemplate

Hi--I am creating a WPF app with a list box that I am binding to project names. As a decorative element, I want to place a small icon next to each item in the list, similar to the way Outlook does in its Personal Folders list. For starters, I am going to use the same image for all items in the list. Here is the markup that I've got so f...

[WPF]How to set width and height of a grid that is in a data template

Having the following wpf code: <Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:WpfApplication5" Title="Window1" Height="300" Width="300"> <Window.Resources> <c:Places x:Key="PlacesData"/> <Dat...