wpf

WPF 3D Perspective camera question

I am working on a 3D flip control that can flip horizontally, vertically and can have any size and square or rectangular shape. While I have it working, I ran into a very odd issue with the perspective camera. When I create a MeshGeometry3D I scale to the proper ratio of the content. If the width > height, all is well. However, if he...

Drawing Directed Acyclic Graphs: Minimizing edge crossing?

Laying out the verticies in a DAG in a tree form (i.e. verticies with no in-edges on top, verticies dependent only on those on the next level, etc.) is rather simple without graph drawing algorithms such as Efficient Sugiyama. However, is there a simple algorithm to do this that minimizes edge crossing? (For some graphs, it may be imposs...

WPF Formatting Issues - Automatically stretching and resizing?

I'm very new to WPF and XAML. I am trying to design a basic data entry form. I have used a stack panel holding four more stack panels to get the layout I want. Perhaps a grid would be better for this, I am not sure. Here is an image of my form in action: http://yfrog.com/7gscreenshot1impp And here is the XAML code that generates it:...

OneWay binding throws "TwoWay binding is invalid on Read only property"

This binding <tk:DataGridTextColumn Binding="{Binding Path=Id, Mode=OneWay}" Header="Sale No." Width="1*" /> Gives this error A TwoWay or OneWayToSource binding cannot work on the read-only property 'Id' of type . . . The "Id" property is indeed readonly, I thought though that Mode=OneWay would be sufficient. I'm tired and...

WPF List of ViewModels bound to list of Model objects.

In the model, I have: public ObservableCollection<Item> Items { get; private set; } In the ViewModel, I have a corresponding list of ItemViewModels. I would like this list to be two-way bound to the model's list: public ObservableCollection<ItemViewModel> ItemViewModels ... In the XAML, I will bind (in this case a TreeView) to the...

displaying a WPF Window from a System.Configuration.Install.Installer class

Greetings all, I have a question. I have created a WPF application. So, I naturally created an installer (Visual Studio Install project) for it. In the Commit section of the installer I want to launch a WPF window which is my configuration wizard. So I created a Installer class, overrode the Commit method and put the following in ...

Simplest way to create a wrapper class around some strings for a WPF DataGrid?

I'm building a simple hex editor in C#, and I've decided to use each cell in a DataGrid to display a byte*. I know that DataGrid will take a list and display each object in the list as a row, and each of that object's properties as columns. I want to display rows of 16 bytes each, which will require a wrapper with 16 string properties. W...

Is there a bare bones sample WPF sample App?

I am looking for a sample line of business app that has source code available. I am just starting out with WPF so something with a GUI that add, update and delete from a db will be perfect. ...

WPF Trigger / Style overrides another

I have a listview defined as such <ListView Width="auto" SelectionMode="Single" ItemContainerStyle="{StaticResource ItemContStyle}" .... Then in "baseListViewStyle" I have defined some base styles to apply to my lis...

DataGrid row and MVVM

Hi, I have a wpf datagrid with many rows, each row has some specific behaviors like selection changed of column 1 combo will filter column 2 combo, and what is selected in row 1 column 1 combo cannot be selected in row 2 column 1 combo, etc... So I am thinking of having a view model for the main datagrid, and another for each row. Is ...

How to get dynamic value from View in ViewModel?

I am coming across a scenario where I need to do something in the viewmodel according to the current selection in the view, but according to MVVM, the view model should not know about the existence of view, then how can i get the dynamic selection in the view? ...

WPF How to bind to a specific element in the Collection

Hi, I want to make a binding to a specific element in the Collection. But I cannot figure out how to write the Binding. This is the code: public class MySource { .. public string SomeProp; public ICollection<T> MyCollection; .. } this.DataContext = new MySource(); <TextBox Text={Binding SomeProp} /> <TextBox Text={Binding FIRST_...

Selected Text of The ComboBox

how can I get the selected text on the SelectionChanged event of the comboBox here is my code <ComboBox x:Name="cboRecordType" Margin="2,0" Height="23" Grid.Column="1" VerticalAlignment="Center" SelectionChanged="ComboBox_SelectionChanged"> <ComboBoxItem Content="Weight"/> <ComboBoxItem Content="Height"/> ...

MVVM: where is the best place to integrate an id counter, in ViewModel or Repository or... ?

Hello, I am using http://loungerepo.codeplex.com/ this library needs a unique id when I persist my entities to the repository. I decided for integer not Guid. The question is now where do I retrieve a new integer and how do I do it? This is my current approach in the SchoolclassAdministrationViewModel.cs: public SchoolclassAdminist...

WPF custom DependencyProperty notify changes

Hey guys I have a class called MyComponent and it has a DependencyProperty caled BackgroundProperty. public class MyComponent { public MyBackground Background { get { return (MyBackground)GetValue(BackgroundProperty); } set { SetValue(BackgroundProperty, value); } } public static readonly DependencyPrope...

WPF DataGrid Entity Framework: Is it possible to bind a datagrid column to a method/function?

Hi. I'm wondering if it's possible to bind a gridcolumn (field) to a method or function of an entity? For example I have two entities Person and Company that both inherit the abstract entity Addressee. In my grid I'm listing all Addressees (both persons and companies). I have a column, Name, in the datagrid that I whish to bind to a f...

wpf slow effect and low speed animation ?

Hi Let me explain about my problem: I have a wpf form with few controls. some of these control over-writing template. for example a textblock with an effect will be trigger on Mouse-Enter event and change color of foreground to something else. But after running program when mouse enter on textBloc, it takes a few Milli-seconds until ...

How do you compose DataTemplates / link to a child datatemplate in WPF?

Here's the problem. Given a large/intricate datatemplate A, which has 3 sections - General, Properties, Misc. Imagine 3 grids for each. Now I need to reuse the Properties section of the above Datatemplate in another place. Reasons: To avoid redundancy + ensure that further updates to the datatemplate are applied identically to all usages...

Styling WPF Toolkit DataGrid Column Headers

Hi, I'm having an issue styling the WPF Datagrid, I've styled the column headers (of type ColumnHeader). But when the data in the columns does not fill the full width of the grid an additional column is added to pad out the grid. This column ignores the ColumnHeader style and looks out of place presumably because the element has a d...

Style Data in a gridview which dynamically generates the columns

I have built a dynamic gridview using the following code grdVariants.Columns.Clear(); int i = 0; foreach (DataColumn column in options.Columns) { grdVariants.Columns.Add(new GridViewColumn { Header = column.ColumnName, DisplayMemberBinding = new Binding(string.Format("[{0}]", i++)) }); } This wil...