wpf

How to set Height of items in XAML so they always occupy the same proportion of available space in parent ItemsControl?

I have an ItemsControl with the following ItemTemplate: <DataTemplate x:Key="myItemTemplate"> <TextBlock Height="???" Text="{Binding Path=Description}" /> </DataTemplate> My question is, how do I set the Height of the TextBlock in the template so that it automatically assumes ItemsControl.Height div ItemsCount amount of vertical s...

disable Aero Snap (wpf)

Is it possible to disable the automatic window-docking feature of windows 7? ...

How to set TextSearch.Text for a combobox whose TextBlock uses converter?

In the below code, Combobox is wired to NameInfo object along with a converter.NameInfoConverter returns a format in which items in combobox are shown in a particular format (for eg: LastName, FirstName (Badge#) ) Now, when I set TextSearch.Text="{Binding NameInfo, Converter={StaticResource NameInfoConverter}, ConverterParameter=true}" ...

How to reverse items in WPF Datagrid?

If i have DataGrid which looks like: Col 1 Col 2 ------- ------- 1 a 2 b 3 c ... ... n n Can the order be reversed easily without sorting? So that n is first, and 1 is last. I have custom sort implemented from this article, but sorting the same column twice in a row calls sorting function twice (which is ...

Entity Framework UpdateException relationships in Added and Deleted states

Hi, I have a table of Plants and Information. Plants have an ID, Name, ..., MainInformationID Information have an ID, Title, ..., PlantID One plant can have many information, but only one MainInformation. Information can only have one plant. I have a class ViewModel which contains observable collections of plants and information whi...

Resize a WPF window, but maintain proportions?

I have a user resizable WPF Window that I want to constrain the resizing so the aspect ratio of the window stays constant. Ideally I would like to constrain mouse location when the window is being resized by dragging a corner to positions that maintain the proper aspect ration. If an edge is resized with the mouse, the other dimensio...

WPF: creating an app that looks like Visual Studio 2010

Hi! How do you create a desktop application using C# that would look like Visual Studio 2010? Here's an example What development environments can you use? Can you recommend any samples, tutorials or blogposts? edit: I think I found what I was looking for... http://wpfthemes.codeplex.com/. Thank you all for your answers. ...

Using WPF and SlimDx (DirectX 10/11)

I am using SlimDX with WinForms for a while now, but want to make the switch to WPF now. However, I can't figure out how to get DX10/11 working with WPF. The February release of SlimDX provides a WPF example, which only works with DX 9 though. I found the following solution: http://jmorrill.hjtcentral.com/Home/tabid/428/EntryId/437/Dire...

IDataErrorInfo with ValueConverter

I'm somehow doing it wrong, but I can't figure it out: I have a model like this: public class Person : IDataErrorInfo { public DateTime Birthdate { get { return _birthdate; } set { if (!Valid(value)) AddError("Birthdate", "Birthdate not valid"); _birthdate = value; } } } A ValueConverter like this...

WPF Applications Size Vs Winforms App Size

Does WPF compiled code is bigger or smaller than Winform compiled code? Does WPF generates more code behind that Winform does? I have a Winform App and I want to make a new version on WPF. Customers get the updates of this app by dowloading it. So my question is, If I make the application now on WPF just using the same screens how bigger...

refresh datagrid on view from viewmodel

I have a datagrid on a view that is bound to a viewmodel. When I initialze the view, the datagrid is populated with data from the viewmodel (ObservableCollection) as it should. However, with I try to do a search against the data, the datagrid does not get refreshed from the viewmodel. When I breakpoint the code in my viewmodel, I can see...

Screenshooting a wpf control from asp.net MVC

Hi, I have a smll web solution where i allow usres to upload small wpf controls to be saved for later use, one of the things i want to do is make a screenshot of the wpf components being uploaded. Im using asp.net mvc and looked into the RenderTargetBitmap, but cant seem to get it to work. - My first problem is adding the reference to "s...

Creating blob properties with Entity Framework 4?

I am creating an EF4 model-first application with a WPF UI. One of the controls on my UI is a RichTextDocument, which outputs a WPF FlowDocument. I can either serialize the FlowDocument to a byte array, or extract its XAML markup as a string. I would prefer to use binary serialization, if I can. Here are my questions: If I serialize t...

WPF ToggleButton changing image depending on state

I would like to use ToggleButton in following way: There are 5 different images and each of them should be displayed depending on current state: button disabled button enabled, unchecked button enabled, unchecked, pointed by mouse cursor button enabled, checked button enabled, checked, pointed by mouse cursor I've found a simple exam...

WPF: Updating visibility of controls not updating the screen

I will preface this by stating that I am new to WPF programming and may be making multiple errors. Any insight that can be provided to help me improve in my skills are greatly appreciated. I am working with a WPF application and am looping through a list of objects that contain properties that describe a document that should be built on...

CultureInfo on a IValueConverter implementation

When a ValueConverter is used as part of a binding, one of the parameters to the Convert function is a System.Globalization.CultureInfo object. Can anyone tell me where this culture object gets its info from? I have some code that formats a date based on that culture. When i access my silverlight control which is hosted on my machine, ...

Binding DynamicObject to a DataGrid with automatic column generation?

I'm still experimenting with DynamicObjects. Now I need some information: I'm trying to bind an object inheriting from DynamicObject to a WPF DataGrid (not Silverlight). How do I get the DataGrid to automatically create its columns from the available public properties of the object that are typically generated at runtime? Is that possi...

Mouse position in xaml - wpf

Hi all Is it possible to specify the position of the mouse as the value of the Parameter property of a Command in XAML. Something like the following: <UserControl.ContextMenu> <ContextMenu> <MenuItem Header="Create Link" Command="{Binding CreateLink}" CommandParameter="{Bi...

How to use Combo Box AddRange in WPF C#

Hi everyone, I have a little problem, I have an array and I want to add that in a Combobox, so I want to use the AddRange method, but it isn't available in WPF, is there a way that I can do it in the combobox? Thanks. ...

MVVM- View Model-View Model Communications

How do I go about having two view models communicate with one another using MVVM Light. I know how to use the messenger class and register etc.. Here is my Scenario A Settings View ---> a Settings View Model . . . A MainPage View ---...