wpf

WPF DataGrid icon and boolean value

Hi, I have: public class Person { String name { get; set; } String address { get; set; } bool isMarried { get; set; } } My datagrid gets populated with a list of persons. I want to have a custom column where icon-1.jpg is displayed when isMarried is true and icon-2.jpg is displayed when isMarried is false. How do I do this in WPF...

Cannot find resource named 'Locator' thrown at design time in Blend 4, WPF4.

Hello everybody, In the application I am developing, I have a MainWindow, which is divided in several Views. Each View is a UserControl and has its own ViewModel. By setting a DataContext inside the UserControl, I am able to work in Expression Blend 4 with design-time data. Ops, forgot to say: I am using the "basic" Locator class, no M...

reverse engineering a camera

If I have a list of 3D points and their 2D projection on screen, is there a way to compute the camera that performed the projection? I am using the WPF perspective camera. ...

Arbitrary ray test using C# and WPF

I want to know if a ray from an arbitrary point will strike a polygon. It would be useful to know the point in space that intersection occurs and also a reference to that polygon. I'm using the System.Windows.Media.Media3D library and have done a ray trace test but have yet to crack any of teh information i want out of the HitTestResult ...

WPF Forcing MouseDevice to be pressed

Hi! I have a windows form in a wpf window, and I'm trying to use DragMove when I click on the windows form, it's a picturebox so I want to be able to drag the window around just by clicking the picture. I catch my form's mouse down, and raise the wpf window's mouseleftbuttondown event with: if (e.Button == MouseButtons.Left) {...

"Object reference not set to an instance of an object." when setting a listview template.

I'm trying to switch between 2 templates on the basis of a data trigger. But I app crashes with the "Object reference not set to an instance of an object." If I comment out the setter for the template it runs fine. Here's my XAML: <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="Template" V...

Different bound properties on ComboBox

I Have a ComboBox and I would like to bind to two different properties, one in the ComboBox and one in the ListBox. The properties are named Summary and Description. How can I accomplish this? I Currently have this <ComboBox x:Name="comboBox" ItemsSource="{Binding}" DisplayMemberPath="Summary" Displa...

Can I use a GridViewRowPresenter to merge cells?

I have a ListView and GridView within it. Upon clicking a button on any row I set an error state based on which I need to change that particular row's cell structure. For eg. I need it to go from a 5 column cell to a 3 column one. Can I accomplish this using a GridViewRowPresenter? ...

How to hook up chm help file to custom Ribbon buttons in Excel Add-In (RibbonX)

VS2008, Excel 2007, RibbonX, Excel Shared Add-In, Not VSTO There is no property in RibbonXML that I can set help to a ribbon button I can't get hold of reference to any particular ribbon button, I only can get a reference to IRibbonUI in RibbonLoaded call back Anyone know how to accomplish this? thanks ...

Getting a BlockCollection object which contains a Block object.

What would be the easiet (and possibly fast) way to get a BlockCollection object (System.Windows.Documents namespace) which contains a given Block-type object? I could not find any direct way of doing this using what's available on Block class. public static BlockCollection FindContainingCollection(Block block) { // ??? } ...

Retrieve all DataGridRow's from a DataGrid

I'm trying to get a hold of all DataGridRows for a DataGrid, don't ask me why :) The DataGrid is bound to a DataView and I'm using this code but it failes after some rows.. I guess that they haven't been created yet. foreach (DataRowView item in datagrid.Items) { // Sometimes row == null... DataGridRow row = dataGrid.ItemContain...

Controls in a WPF UserControl don`t raise lost focus

Hello, I have a MainWindow with 3 main buttons at the top and below a MainUserControl. In the MainUserControl I have at top 3 UserControls with ButtonBars and at the bottom a DataGrid. When I enter data in a DataGridCell and I click into another cell a property change is fired in my ViewModel bound to the DataGrid. When I enter data...

WPF UI Automation With Infragistics Controls

Does anyone have any good pointers/examples/links for writing WPF UI automation tests with applications utilising Infragistics controls? ...

WPF Changing text in a controltemplate at run time

I am making a template control so that I can have a button with an image that changes when you click it. I also am trying to get text on top of the button that can change at run time. I have the button images and everything working but I can't seem to get that label at runtime so I can change the text. Here is the code in the xaml. I...

How to translate lists in a MVVM model to ObservableCollections in the View-Model?

I am writing a sample app in WPF and I'd like the Model to be easily reusable in a WinForms app so I'd like to keep WPF specific stuff like INotifyChanged and DependencyObjects out of it. If a Model class has a List of some other Model class, how do I implement the corresponding ObserveableCollection in the View-Model so I can keep my b...

Blend 4 can't find namespaces in C++/CLI .dll

My WPF4 XAML has bindings that reference objects in my C++/CLI .dll. In VS2010 the XAML passes verification, but Blend 4 is very borked. It can't find the namespace within the CLI dll. In the 2008/.NET 3.5 days I could remove the project reference and replace with the compiled .DLL in Blend and go on my merry way but this doesn't work ...

WPF ScrollBar: both horizontal and vertical from one template?

I have a requirement to retemplate the Scrollbar so that only one template is required, instead of separate horizontal and vertical ones. The designer's assertion is that the scrollbar can be rotated on a trigger (Orientation = Horizontal), and the commands swapped on the buttons. Since the single template is set up as a grid with rows,...

Scrollbar is visible in ListBox even if the datacontext is set to Null?

When i set a lisbox with 100 items , list box is showing Vertical scrollbar(horizontal scrollbar is disabled) and is working perfect. But when i change the datacontect with 5 items, the scrollbar is still showing and i can see only the first item. But when i try to move the scrollbar it is displaying the all the 5 items and scrollbar is ...

C#, UserControls: I cannot alter txtBlock.Text, it gives an "object reference is required for the non-static method" error!

I was recently having some issues with a bigger project, but in an effort to solve the problem, I made a new solution with just two incredibly basic files. It is a WPF C# project with the main window containing a button, and a usercontrol containing a textblock. I already have them linked in Blend so that when I click the button, the use...

WPF/C#/MVVM: Need Some Help Implementing Custom View Options for User Control

The project I am currently working on is a text editor type app. I am wondering how I can handle custom view options. eg. font family, size, bold, colors for myTextBox. My Editor Tab is a EditorTabViewModel within the View is a custom user control MarkdownEditor. Its basically a text box with some buttons for bold/italic etc. I am wonder...