wpf

TemplateBinding a Title in custom window template WPF

Hi guys, So I'm making a custom window template for my WPF application. The trouble I'm having is that I cannot access the Window Title property inside the template. I tried this: <TextBlock Text="{TemplateBinding Title}" /> And this: <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}" /> Ever...

WPF Application template is missing

My VS2010 install has WPF Browser application project template, and WPF User Control lib template, but no WPF Application template. Any suggestions would be appreciated. ...

Can I have complete control on the drawing of a custom WPF button?

I imagine you can draw prety much anything with enough XAML experience, but i'm a C++ guy new to WPF. I need a button that has a gradient color plus a special border around it. So what do us C++ guys do? We go to the designer, ask for a Left vertical image, Middle one and Right one, and then overriding the Win32 drawing messages practica...

WPF drag and drop and update the UI at the same time

Im using WPF 4 and trying to get used to the Drag and Drop API with touch, not the mouse, I have easily got a drag operation working that drops onto a Grid, but what I want to do is, when the user is dragging over the grid, change its color. I have got all the code working, and I even put heaps of Console.WriteLine() calls within my Dra...

mvvm wpf messenger class, unregistering messages

Hi guys, I am using Josh Smith's MVVM Foundation project Messenger class and just had a question regarding unsubscribing messages. At the moment I have multiple ViewModels which register messages as strings for example I have - ViewModelA - registers for message "A" ViewModelB - registers for message "A" So the both registered message...

WPF MVVM call ViewModel Save method on Window Close

Hello, I have figured out how to close Window from my ViewModel. Now I need to solve window close problem from the other side. I need to trigger Save() method in my ViewModel when the user clicks window's close button. I was thinking about binding Command property to Window's close event, but my ViewModel is related to the user cont...

Validation empty fields in MVVM

Hi, I have a XAML with about 100 controls. All of them are bound to class Student. I can validate such pool like Age, or Name, but how to validate controls,which user not even touch ? For example for field Address. Address couldn't be null, but user forgot about filling this control. ...

WPF: Binding to single complex item

Hi there, In my application, I use a UserControl instance to display the contents of a complex type that implements INotifyPropertyChanged that is a ViewModel to display the current state of background processes. This ViewModel is exposed to the UserControl as a DependencyProperty. The DependencyProperty is being set nicely, and events...

Binding value to checkbox

I have class Student { public List<Degree> Degrees {get;set;} } class Degree { public Subject Subject{get;set;} public int Value {get;set;} } class Subject { English =0, Germany = 1, Biology=2 } And I have a Treeview <HierarchicalDataTemplate DataType="{x:Type MyService:Student}" > <TextBlock TextAlignment="Justify" VerticalAl...

PRISM and WPF how to add a module on demand

Hi, I have a set of tabs in my shell window and one main region whicxh is a contentcontrol. I also have four modules that I want to load on demand when a certain tab is selected. So when tab1 is selected I want to load moduleA, when tab2 is selected I want to load ModuleB, etc. The first module loads on when the application starts. The p...

How to caputure an Bitmap created from a Windows Forms control to a BitmapSource?

Hello. I want to caputure an image of a control which is an ActiveX imported control and display that image in WPF. The reason I do not use the windows forms host is that it is too slow (i want to create a list with these activex controls) : so far i have: public Bitmap CaptureCtrl(Control ctrl) { // Ein neues Image mit...

How to show a menu on top of the window's title bar

I was trying for some time now to show a menu like this one on my WPF title bar (the orange one in the upper left corner): https://wiki.mozilla.org/Firefox/4.0_Windows_Theme%20_Mockups#Large_Button_Mode I've extended the aero glass into the client area by using the DwmExtendFrameIntoClientArea method. The application icon in the upper ...

DrawingVisual DependencyProperty not Inheriting from Parent

I have a class that inherits from DrawingVisual. It declares a DependencyProperty which, when registered, should inherit its value from a parent. I then create a parent-child relationship between two instances of this class. I set the parent DependencyProperty but the child's DependencyProperty does not return the parent's value. Can...

Detecting When A Scatterview item is inertial

The ManipluationDelta event has the IsInertial property. Unfortunately it appears that a scatterview item 'ManipulationDelta' event does not fire. Only its ContainerManipulationDelta event fires, but the ContainerManipulationEventArgs does not expose the IsInertial property. So is there any other way to determine when a scatterview item...

WrapPanel as ItemPanel for ItemsControl

Still fooling around with WPF and learning as I go. Trying now to build a dynamic grouping of controls ( mostly buttons but might include checkboxes and others ). I had no idea what was the best way to do this so I tried creating a ItemsControl style and then add the items into a itemspresenter inside a wrappanel. Soon realized the item...

WPF - RelativeSource Binding Problem

Hi All, I am trying to create a back button. So i am binding the navigationwindows backstack. Code: <Hyperlink Name="back" NavigateUri="{Binding RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}, Path=BackStack}"> Problem: Error: Mode must be specified for RelativeSource. Update: It is not navigation to th...

Problem with actualheight of a user control

Hello, In my WPF app I have the following user controls: <UserControl Name="UCOperand" ...> ... </UserControl> <UserControl Name="UCOperation" ...> <ItemsControl Name=ic_items>...</ItemsConrol> </UserControl> The UCOperation user control can contain UCOperand user controls in it's "ic_items" ItemsControl. Now I have a design p...

WPF: binding to a dependency property

I am following a tutorial here. which shows a basic example on how to bind to a dependency property. <Binding ElementName="This" Path="IPAddress" UpdateSourceTrigger="PropertyChanged"> where "This" is the name of the current window: <Window x:Class="SOTCBindingValidation.Window1" x:Name="This" whenever i try to do something like t...

Accessing ItemsSource source item

I'm creating an error list control similar to the in Visual Studio. Each error is represented by a class with three values: type (enum: Error/Warning/Message), text (string) and time (DateTime). The class has also two more read only getters: TimeString (returns time as HH:MM) and Icon (returns icon path based on type). I have an ItemsCo...

Exception not showing

I have : public class Person : INotifyPropertyChanged { private string _name; public int Age { get; set; } public string Name { get { return _name; } set { if (!String.IsNullOrEmpty(_name)) { if (String.IsNullOrE...