wpf

How to bind in WPF a whole object to an user control?

People use frequently something like: <ListBox ItemsSource="{Binding ElementName=thisControl, Path=ListIndexes}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content="{Binding Path=IndexName}"/> <Label Content="{Binding Path=IndexValue}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> But I would like ...

WPF Newbie question

I'm trying to learn WPF animations and am currently confused by quite a few things: I used tools like processing, where you have a simple method which is called n times per minute, where n is the frame rate. The way to do animations in WPF is to modify a property. If i use for example DoubleAnimation then a double is increased as the a...

z-Order of application windows - WPF

Is there a way to find out the z-order of all active windows in my application (application.current.windows) or any other way to find out what is the "parent" window of a modal window? I am trying to implement a "shader" functionality, that should fade the parent window when a modal window is shown. (the only way I have found so far i...

Image.FromHbitmap WPF equivalent

Hello. Is there a System.Drawing.Image.FromHbitmap equivalent in WPF? Also, is it possible to dispose the handle properly after creating an image? Thank you. ...

How do I create a new row in WPF DataGrid when it is bound to an XmlDataProvider?

I have a project with an XmlDataProvider bound to a WPF DataGrid control. I have the bindings on the DataGrid set up as follows: <dg:DataGrid ItemsSource="{Binding Source={StaticResource XmlData}, XPath=Root/People/Person}" AutoGenerateColumns="False"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header="ID" Bin...

What's the easiest way to create a WPF progress bar without the dashed style?

I'm looking to create a progress bar that doesn't use the WPF default style, which uses a dashed display. All I want is a simple, "smooth style" progress bar. In other words, I don't want to progress bar to be dashed. I want it to use a solid colored bar. What's the easiest way to do this? I assumed this would be part of the default...

INotifyPropertyChanged problem

At first I want to say that sample below is oversimplification. Suppose you have bound WPF control. <Window Title="Window1" Height="300" Width="300"> <Grid> <StackPanel> <TextBox Text="{Binding Name}" Margin="10"/> <Button HorizontalAlignment="Center" Content="Click Me" Margin="5" Padding="2" Click=...

Where can I find a free masked TextBox in WPF?

Do you know any freely available WPF component for using masks (regex) in textbox? ...

How portable is Silverlight code to WPF?

In Silverlight I noticed that the code-behind Page class inherits from UserControl: public partial class Page : UserControl In WPF the code-behind Page Class inherits from Page: public partial class Page1 : Page I was thinking that Silverlight, being a subset of WPF, you would be able to copy large blocks of Silverlight code into W...

WPF binding to My.Settings for radiobuttons (using vb.net)

Following the advice at http://stackoverflow.com/questions/204779/wpf-binding-my-settings-collection-to-combobox-items I was able to get binding working for checkboxes but not for radiobuttons? After saving MySettings the checkbox value is either true or false depending on if the checkbox is checked or not (as expected), while the rad...

WPF- Is there a way to Databind a System.Attribute assigned to a ViewModel

Is there a way in WPF to Databind to a System.Attribute which is attached to a proerty on A ViewModel. For Example I have some properties on a my ViewModel class. These classes have attributes that define the fields label text or caption. Is there a way to databind to the value in the attribute. In the example below I want to use databin...

best practices for hard-coded sizes in XAML

I'm aware that in WPF you want to keep the sizes of controls as flexible as possible so that they can flow and expand depending on their context (like in CSS). But most of the code examples I come across are hard-coding sizes like the heights in this example: <Grid.ColumnDefinitions> <ColumnDefinition Width="0.5*"/> <ColumnDefi...

ListView Binding with "IsSelected" Property of ListViewItem

Hi All, I have following class public abstract class AbsTrinityEvent { public event IsSelected OnSelectedEvent; bool _IsSelected; ITrinityEvent _objTrinityEvent; public AbsTrinityEvent(ITrinityEvent objTrinityEvent) { _objTrinityEvent = objTrinityEvent; } public ITrinityEvent TrinityEventOb...

Find out if WPF windows has been already loaded (Loaded event fired already)

Hello. Is it possible to find out whether WPF Window is loaded? I have a method which accepts a window and hooks 'Loaded' event to it. If window is already loaded, the event will not fire. Is it possible to know this when accepting the argument? Thank you. ...

WPF IDataErrorInfo slowness

I keep noticing that IDataErrorInfo usage slows my software. When I type text in an TextBox, the text seems to lag behind a bit. When i remove the IDataErrorInfo implementation in the data-class being used for binding, it acts normal... Any pointers on this? PS: Laptop is a MacBook Pro 2.4Ghz with 2gb RAM, so that should not be an issu...

Implementing and using the ICommand interface, MVVM

Although I deeply fell in love with the MVVM pattern there seem to be a lot of problems I cannot (yet) figure out for myself. I wonder what the parameters of the methods of the IComamnd interface are good for e.g. void Execute(object parameter); I tie my view to the view model like this <Button Command="{Binding SomeCommand}" ... /> ...

What is best practices for printing from a WinForms application?

I am looking for best practices in regards to printing from a WinForms application. What are the pitfalls? What layout techniques work? Would it be easier to use WPF for printing (MSDN WPF Printing Overview)? In my particular case, I have an existing WinForms application that needs to be extended with printing functionality. The pro...

Are there any good books on M-V-VM in WPF?

I've seen a lot of book recommendations for WPF here, but no witch is specific to MVVM. ...

Force validation on bound controls in WPF

Hello. I have a WPF dialog with a couple of textboxes on it. Textboxes are bound to my business object and have WPF validation rules attached. The problem is that user can perfectly click 'OK' button and close the dialog, without actually entering the data into textboxes. Validation rules never fire, since user didn't even attempt ente...

How to refer to Canvas in another XAML File?

I have a problem with figuring out how to refer to a Canvas in another XAML file in my project, for example there is a Canvas object containing some labels, images called MyLayout and is stored in MyLayout.xaml I want to use this Canvas in the main Window of the application in Window.xaml - how can this be done, as there will be multiple...