wpf

Attaching a custom DependencyProperty to a StackPanel in WPF?

I'm trying to make a mouse over for a stack panel in WPF using a custom DependencyProperty (StackPanels do not handle the MouseEnter event). I've created a class for the DependencyProperty like so: Public Class MouseEnterBehavior Public Shared Property MouseEnterProperty As DependencyProperty = DependencyProperty.RegisterAttached...

How to set the style programatically

I have the following style but i need to make it programatically: <xcdg:DataGridControl MinHeight="300" Name="listViewUnallocated" ItemsSource="{Binding Source={StaticResource cvs_unallocatedTerminals}}" AllowDrop="True" ...

Applying TextDecoration to an WPF ListViewItem

I can see how to apply a text decoration to a GridViewColumn. <GridViewColumn Header="Tool" > <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Entity.ToolId}" TextDecorations="{Binding Path=TextDecoration}" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> But if ...

How to split a PathGeometry Polygon by an intersecting line segment

I've got a PathGeometry that I've built from a bunch of LineSegments, and I want to split it into two PathGeometries divided by a line intersecting down the middle of the geometry. Here's what I mean by this picture: http://i30.tinypic.com/2noyvm.png I can go through the LineSegments and create an array of simple line objects (simple ...

Problem with UpdateSourceTrigger=PropertyChanged and StringFormat in WPF

Hi, I have a text box in my application which is data bound to a decimal field in my class and the binding mode is two way. I am using StringFormat={0:c} for currency formatting. This works fine as long as I don't touch 'UpdateSourceTrigger'. If I set UpdateSourceTrigger=PropertyChanged , It stops formatting the text that I am enterin...

DataTemplate DataType usage WPF

I had been setting the DataContext for UserControls like so: <uc:DepartmentListingView DataContext="{Binding ., Mode=TwoWay}" /> Based on a sample project by Josh Smith I am trying to accomplish the same thing with a DataTemplate and DataType: <!-- Template applies a DepartmentListingView to an instance of the DepartmentSelectionView...

WPF test higlighted

Hi, I have a treeview that look like this: Header a) sub header 1 b) sub header 2 The header will play both a) and b) video. So when I click the header, The default background colour of the treeview is blue while the foreground is white colour. When it is playing on a) I want that default background blue to be automatically highl...

Is there any general procedure to implement command in MVVM if the element doesn't support command?

is there any particular way to implment command in MVVM if the element doesn't support Command. Example how to implement the TextChanged_event for the TextBox?. ...

Active code in XAML properties

I have a situation where I want UIElement to have a top margin of ((this.height / 2) - 70) Currently, the XAML property is Margin="0, 40, 0, 0" How can I combine the equation above into my XAML? I know this is probably simple, but I can't figure out what terms to search for. ...

How to put borders in panels background like outlook day view, when the panel is sizable?

I'm talking WPF... I have a panel (with virtualization). The panel has a custom measure and arrange implementation. I want the panel background to look like Outlook calendar in the day view (with the lines for each amount of time) any suggestions? ...

Need to tab out of ActiveX control in browser

When tabbing through controls in an ActiveX control hosted in IE, once I get to the last control the tab key no longer does anything. I would like it to move the focus outside the ActiveX control to the next html control. This works fine when the ActiveX control is hosted in a WinForms app, does anybody know how to make this work in the...

Design-Time Population of ListBox with Sample Data in WPF

I have a view (usercontrol) that contains a listbox. At runtime the listbox will be populated with instances of another view (also a usercontrol). How can I populate the listbox in design-time (in Blend and Cider) with sample views that are themselves populated with sample data? ...

WPF: drawing own cursor - nontrivial problem

i need to implement a cursor with some very specific features: it has to be animated because after n seconds it automatically clicks - so the animation is feedback for the user when the click will happen it has to snap to some of our controls it has to work outside of our application the approaches so far: render my WPF-control i...

Wrong reading order in Narrator

Dear all, I've got a problem with Microsoft Narrator. I've got a WPF fragment like this: <Window x:Class="InlineEditbox.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Narrator test" SizeToContent="WidthAndHeight"> <TextBlock> ...

How to create viewmodel for a model which has collection

I have a class : public class Car { public string Name { get; set; } public int Age { get; set; } public Wheel[] Wheels {get;set;} } Collections of wheels can be changed Every properties of Car will be showing at the same control I want to see how make a ViewModel for this class. Had I good understood c...

Making control with attached property in code behind (WPF).

I have UserControl1 and I want to create it's instance and set attached property for it in the code behind of the other UserControl2. The other words, I have in the UserControl2: <UserControl2> <Canvas> </Canvas> </UserControl2> And I want to do: <UserControl2> <Canvas> <UserControl1 Canvas.Left="100" ... /> </Canvas> </...

How to apply style in WPF Grid's first row at run time.

How to apply style in WPF Grid's first row at run time. ...

[WPF] Creating a custon control extending Image

I have a Custom control extending Image, and I will put some more data on top of that image. However, when I am trying to style the component, I am getting the error that my Custom Control don't have the property Template. Error: Cannot find the Style Property 'Template' on the type 'MyCustomImage' How can I style my custom control if...

How do you get Visual Studio to recognise XAML changes?

I have just started with WPF so am probably missing something simple here. I have a window that I am editing in VS 2010. When I change the XAML by hand and then run the application (F5) the window remains as before my edit, however if I do a rebuild and then run the application my changes show up. Is there any way to get VS to recognise...

WPF: Problem with Hierarchy

I've noticed a problem I'm having depending on the Hierarchy of items. When I wan't to represent the items I have no idea how to put it's children in a manageable state. Let's take a TreeView for example. When the window is loaded up I can take the model and put it into a view and as a source for the tree. However I seem to have no real...