wpf

WPF style/control template reuse

Hi, I'm new to WPF, and I would like to know how to reuse some annoying xaml I have to avoid duplicating. <Button Cursor="Hand" HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="MyButton" Style="{StaticResource ButtonTemplate}" Width="286" Content="hi!" Focusable="False" IsTabStop="False"/> <Button Cursor="Hand" HorizontalAlignment="L...

WPF MVVM UpdateSourceTrigger=Excplict

Hello, i've a contentcontrol in my Wpf-App (MVVM) which is bound to an object and displays the objects properties in textboxes, so the user can edit the values of the properties. I want to implement undo/redo functionality with the command pattern of the GoF. For this i need a point where i can create the command and set it into my undo...

WPF - Saving font to disk, then instantiating GlyphTypeface for font throws exception. Why?

I am mucking about with WPF glyphs and documents and have run into a null reference exception in the .Net 4 framework. I extract and save true-type fonts to disk as .ttf files, then try to create Glyphs based on the fonts. The first time I save a font to disk and instantiate a GlyphTypeface based on the font after creating a GlyphTypefa...

How can i tile multiple wpf windows horizontally or vertically??

Hi all, I want to tile my all open windows Horizontally/Vertically. So that i can see them all together. Please help me on this ...:-(( ...

How to get started with Microsofts RibbonControlsLibrary?

I'm new to WPF programming and decided to give it a shot by trying out the some ribbon control libraries. The library that looks best for now is the Microsoft RibbonControlsLibrary. You can get it on the ribbon licensing page. So far I've started a new project, added the control to the windows, but them I'm stuck: This is the code so fa...

How can we connect the interface (wpf) and MS ACCess database

I've to do a project with Microsoft Access 'we obliged to make with this tool' I've implemented a user interface (bottoms and effects) using expression blend , and I build my database .The problem how can I make the relation between them. as I read that MS can give us the new features in Access 2010, Microsoft can very well decide to go...

WPF and ADO.NET EF - error

Hi, I keep getting this error: Microsoft.Practices.Composite.Modularity.ModuleInitializeException was unhandled Message=An exception occurred while initializing module 'DiagrammerModule'. - The exception message was: An exception has occurred while trying to add a view to region 'MainRegion'. - The most likely causing except...

WPF: How do I have to setup my model and the binding strategy ?

Regard this image: The TimeTableViewModel of this user interface is this: public string SchoolclassCodeMonday {get;set;} public string SchoolclassCodeTuesday {get;set;} public string SchoolclassCodeWednesday {get;set;} public string SchoolclassCodeThursday {get;set;} public string SchoolclassCodeFriday {get;set;} public string Schoolc...

Binding Items inside a DataTemplate with Items from another DataTemplate

Hi Everyone, I have two Data Template (one for drawing[draw] and another for Input Data[data]) Also I have the two ContentControls which uses the above DataTemplates. I want the both DataTemplate's elements to be binded so that when the user fills in a field in the data form DateTemplate it automatically updates the draw Template as well...

How to manage a failed data validation in WPF?

I have a binding with data validation implemented by IDataErrorInfo. When data validation fails, the property is set. How could I avoid the change of the property when data validation fails? Thank you very much. ...

WPF DataGrid vertical sizing

I want to place a DataGrid inside a HeaderedContentControl but the the DataGrid does not get a vertical Scrollbar. It appears to be sized to hold all rows at once, the bottom disappearing from view. If I place the same DataGrid in a Border elelemnt I do get the behaviour I want. I have reduced it to this minimal example: <Grid> ...

Starting out with .NET - ASP.NET, WPF, Silverlight or Command Line C#?

If someone were starting out with the .NET framework, what is the most feasible template to start with? And by the feasible I mean the one that has the lowest learning curve and the highest gains. Start with: Command Prompt applications in C#? Web applications using ASP.NET? Silverlight applications in XAML/C#? WPF/Winforms Desktop ap...

Windows 7 Style in Windows XP

Whenever I insert the Aero.NormalColor.xaml into my resource dictionary, the only way the program is able to run is through debug mode. If it removed, I can run with debugging and without. Any reason? Here is my App.xaml: <Application x:Class="HTA.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...

How to update a database after a DataGridComboBoxColumn has changed?

hi, I have a wpf datagrid that is bound to one dataset and has two combobox columns that take their values form the main dataset and has options from two different databases, in every other cell (which are regular textbox cells) once editing is finished the database is updated through an dataset.DataTable.RowChanged event, the problem is...

WPF - LayoutStates VisualStateGroup (non silverlight)

Hey guys I have been trying to the LayoutStates state working in WPF when I realised that its a Silverlight only feature (gurrr). Just wondering if anyone knows of an alternative to achieve the same result? If not can the same result be easily achieved manually? Specifically I'm trying to slide in new items when I add them to the list...

VS2010 and WPF slow debug issues

hi all, im (like a lot of other people) doing my first steps in vs2010. one of the things i just found which really annoys me is that each time i try to debug a WPF application the ide slows down so each movement from one statement to the other results in 10 sec. (!) waiting. what can i do ? is there a nice solution (besides not using...

WPF Namespace question - Process?

private void button1_Click(object sender, RoutedEventArgs e) { Process virtualMouse = new Process(); virtualMouse.StartInfo.FileName = "VirtualMouse.exe"; // Needs to be full path virtualMouse.StartInfo.Arguments = ""; // If you have any arguments bool result = virtualMouse.Start(); } but iam getting error ...

Reset control's parent in WPF

Hi, If I add a control to a canvas and than removes it, I can not re-add it to the same canvas (or to any other canvas for that matter) any idea how can I reset the parent? mainCanvas.Children.Add(item); mainCanvas.Children.Remove(item); mainCanvas.Children.Add(item); // Will throw an exception that parent was already set. Thanks,...

Adding text in a new line in WPF RichTextBox at runtime

I want to add some text in a WPF RichTextBox at runtime in a new line. I can do this using: FlowDocument mcFlowDoc = new FlowDocument(); mcFlowDoc = richTextBox.Document; Paragraph pr = new Paragraph(); pr.Inlines.Add(status); mcFlowDoc.Blocks.Add(pr); StatusText.Document = mcFlowDoc; But there is too much of a gap between two lines. ...

Is it possible to register one event to another without helper method in C#?

I have two same events in different classes: A.eventA B.eventB These two events: eventA and eventB are defined via the same delegate therefore the events have the same return value and parameters. Is it possible to fire A.eventA in the moment when B.eventB is fired? I can write a method: void return-value-of-delegate connect(param...