wpf

What is so special about Generic.xaml?

I've been trying to figure out how to organize my ResourceDictionary files for reuse and sharing with other members of my team. I keep coming across "Generic.xaml", but if I look on MSDN for Generic.xaml or just do a Google search, I only seem to get blog posts and forum questions that happen to mention it--I can't seem to hit upon anyt...

Trouble referencing a Resource Dictionary that contains a Merged Dictionary

I have a library, CommonLibraryWpfThemes, with several Resource Dictionary XAML files in it. My Themes/Generic.xml file contains a ResourceDictionary.MergedDictionaries declaration that merges all the other files together. Generic.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x...

design time usercontrols - I can't see anything!

newbie question, please forgive... I'm developing a Wpf UserControl that will eventually be bound to a business object. The usercontrol is little more than a series of laid out TextBlocks, and perhaps (later) an image or two. As I'm laying out the usercontrol, I can put dummy text into all the TextBlocks so I can see what the usercon...

WPF button with graphics for both the button's background and content.

I am skinning my app and want have a generic button graphic for all buttons, and then each button have unique content. I've created a DrawingBrush for the generic button graphic and applied it the button's background using a style defined in my resource dictionary. This all works great. However, when I then try to add something other tha...

In WPF how do you access an object defined in Window.xaml from a nested user control ?

I have a situation where I need to access an object that has been defined in one user control from within a user control nested 2 levels deep. Take the following for example: public class MyClass { public MyClass() { MyData = new MyDataProvider(); } public MyDataProvider MyData; public string SelectedValue;...

Cross platform apps with WPF

Hi, I'm thinking of developing a desktop app in C#. Although windows will be my main target, later I'll try and run the app in MacOS X and linux. Can I do this today, in a simple way? I'm aware of the mono project, but it is not clear to me if I can do this in a simple way. Also, what is the relation between WPF and Silverlight? AFAIK ...

C# WPF toolkit: How can I make a cell from a datagrid be editable?

Take note of the code for this small WPF C# program made with Microsoft Visual Studio 2008: .xaml <Window x:Class="WpfDatagridTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:WpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"...

WPF MVVM Threadsafe way to get List<Object> from ViewModel

I am trying to access a List on a view model from a background worker, but am getting errors because I am going cross thread... This is the problem method on the viewmodel: (I am getting the exception the first line in the function (SMMainWindow window ...)) public static MainWindowViewModel GetMainWindowViewModel() { SMMai...

WPF Binding Question

Here's the situation: Using WPF I have an object set to the DataContext of a window. A listview on this window is bound to display a list of users which corresponds to a property in the DataContext(Users). Whenever a A User is chosen I set the CurrentDisplayedUser to this user to the selected object. I have another list box that's...

How to detect the current theme in WPF's Xaml?

I have a custom control that needs a minor adjustment when running on XP or Vista with the Aero theme, is there a simple way to detect the theme (operating system detection isn't enough because the user can change the theme) and use this in a style trigger? I need to apply a small margin change on Vista to get the look required: ...

How does my View know about its Presenter without DataContext?

In XAML, I'm displaying all my presenters as tab items: <TabControl.ContentTemplate> <DataTemplate DataType="x:Type views:SmartFormAreaPresenter"> <views:SmartFormAreaView/> </DataTemplate> </TabControl.ContentTemplate> I've noticed that each View has access to its respective Presenter's properties even without me ever...

Why are there thin hairlines (1 pixel?) between ItemsControl items?

When I have background colors on the items in an ItemsControl, and set the margins to 0, WPF leaves hairlines between the items as if the ItemsControl wrapper plumbing is taking up a minute amount of space. I checked the visual tree with Snoop and all margins are set to 0,0,0,0. What are causing these lines and how can I avoid them? ...

XAML page Flip twist

I have this Page.xaml <UserControl x:Class="SLBookDemoApp.Page" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:SLMitsuControls;assembly=SLMitsuControls" Width="800" Height="600" Loaded="UserControl_Loaded"> <Grid> <local:UCBook...

Why do XML Namespaces usually start with http://... ?

For example, the WPF namespace is: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" If I define my own namespace, should it also start with http? Isn't http misleading? ...

How to render video from raw frames in WPF?

I have a special video camera (using GigEVision protocol) that I control using a provided library. I can subscribe to a frame received event and then access the frame data via a IntPtr. In my old WinForms app I could render the frame by either creating a Bitmap object from the data and setting it to a PictureBox Image, or by passing the...

WPF set image for a button in the C# code behind at runtime

Hi, I'm very new to WPF, so please bear with me. Basically I have defined a Style in a WPF UserControl to show buttons with an image as follows: <UserControl.Resources> <Style TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> ...

In WPF, how do I give my custom control a default style to be used in Design Mode?

I have created a custom WPF control. The control acts as a container with various regions (so it can work like a master page). The style for this control is loaded at runtime from a separate resource dictionary as follows: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> ...

WPF ICollectionView Refresh

Hi. Is there any way how to do ICollectionView.Refresh() or CollectionViewSource.GetDefaultView(args.NewValue).Refresh(); in a separate thread? I know I can use dispatcher, but this collection is binded to a ListView and it throws cross thread Exceptions. The reason why I need a second thread is, that I have Control which dis...

Represent Many-Many relationship in a WPF listbox

Hi i want to represent a many to many relation in my wpf appliaction.I want to fill a combobox in my listbox according to a relation.But my parent table does not contain a primary key.So i am not able to add a relation also.My tables are as follows Tests Table(no PK) ............ Id TestName Sample 1 Test1 Blood 1 ...

How to add an imagelist to WPF listview?

I don't even see it in the Toolbox in the designer. Is it called something else? I am trying to port my winforms listview to wpf. ...