wpf

Publishing Fails

Tool: Microsoft Visual studio 2008 Project Type: WPF Browser application When after rebuidling all,project is published. it fails with followiung error. Cannot publish because a project failed to build. Could not find file 'obj\Release*.exe'. Clean and rebuild All has been done, no positive signs. System has been restarted, no positiv...

wpf combobox padding

This is a simple question How do you remove the space between the content of a combobox and the border of it. E.g. If the selection of a combobox is "Selection 1" then the "S" is drawn at the very top left of the ComboBox control with no whitespace spacing between it and top left portion of the control. I did this <ComboBox Padding="...

Why the same code in WPF is slower than in Windows Forms?

I made bunch of benchmarks of the framework 4.0 and older and I can't understand why the same code is slower when using WPF compared to Windows Forms: This is the code, it has nothing to do with the UI elements: Random rnd = new Random(845038); Int64 number = 0; for (int i = 0; i < 500000000; i++) { ...

Why I can't style the DataGridTextColumn?

When I tried to create a Style to DataGridTextColumn with the following code: <Style TargetType="{x:Type DataGridTextColumn}"> ... </Style> Visual Studio 2010 highlight {x:Type DataGridTextColumn} by blue line and said: Exception has been thrown by the target of an invocation. ...

wpf scrollviewer scrolltoverticaloffset

The events scrolltoVerticalOffset or the scrolltoHorizontalOffset do not change the values of the scrollviewer. Please tell me at which event does the values HorizontalOffset and the VerticalOffset get changed? I have tried LayoutUpdated() method but it goes in a infinite loop. Thanks in advance ...

Animating WPF buttons from inside a style

Hello. I'm currently trying to make buttons on my forms animate using WPF - this is part of a University course, so it's all about demonstrating knowledge rather than looking good. We've been shown how to animate per-button, but since I want the animation to be the same on every button I'm using a style - something we've not been taugh...

Choosing the right .NET architecture. WCF? WPF/Forms, ASP.NET (MVC)?

I’m in the situation that I have to design and implement a rather big system from the bottom. I’m having some (a lot actually) questions about the architecture that I would like your comments and thoughts on. I don’t hope that I’ve written too much here, but I wanted to give you all an idea of what the system is. Quick info about the a...

WPF - Changing an image resource in a datatemplate programmatically

I have a ListBox showing some objects associated each with some files. I also have a ListView of images linked to the listbox's selection. I would like the listview to show an icon corresponding to the filetype (an image for video, image, doc etc...) of each file with the filename below. I can figure out all the code except how to bind t...

WPF calls not working during long method processing

Hi, The following method does not apply the wpf changes (background = red) until the 2nd method (DoWork) exits: private void change() { Background = Brushes.Red; Dispatcher.BeginInvoke((Action) DoWork); } DoWork() takes several seconds to run and I don't really want to put it into a thread, as this code will be used in several...

WPF refresh after message box closed in vb.net

I have two message boxes one after another. Dim msgResult as MessageBoxResult msgResult = MessageBox.Show("Message", "Title", MessageBoxButton.YesNo, MessageBoxImage.Question) if mesgResult = MessageBoxresult.Yes Then 'some code..... MessageBox.Show("Another message", "Title", MessageBoxButton.OK, MessageBoxImage.Error) End if Wh...

How can I use a parent content control from a sub binding?

I have the following code currently: <DataTemplate DataType="{x:Type vm:SectionViewModel}"> <ScrollViewer> <ItemsControl ItemsSource="{Binding ViewModels}"> </ItemsControl> </ScrollViewer> </DataTemplate> <DataTemplate DataType="{x:Type vm:StringViewModel}"> <Grid> <Grid.ColumnDefinitions> ...

get absolute file path from image in WPF

I have something like this in my xaml: <Grid> <Image Name="image" Source="../../Images/DefaultImage.png" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Image> </Grid> How can I get (using my code-behind c# code) the absolute path of the image source? ...

How to deal with calculated values with Dependency Properties on a custom WPF control

To summarize what I'm doing, I have a custom control that looks like a checked listbox and that has two dependency properties one that provides a list of available options and the other that represents a enum flag value that combines the selection options. So as I mentioned my custom control exposes two different DependencyProperties, ...

Licensing WPF application

Does anyone have any guidance on the best way to manage licensing for a WPF application? I would like to have different levels of licensing (Free, Trial and Professional). The app itself will probably be distributed with a WiX installer (if that makes any difference) ...

Windows Forms Dead. Long life to WPF.

In PDC sessions i see only Framework 4.0, Azure and WPF. My all applications is in windows forms and asp.net (codebehind) and framework 2.0 or 3.5. I see i'am obsolete, ok. But my questions is Windows Forms is dead, i need start migrate to WPF or Silverlight? or my Windows forms with Devexpress can leave more than 3 years? ...

Global event handler

How can I define one global GridViewColumnHeader.Click handler for any ListView.GridViewColumnHeader in my project? I mean is it possible to set a Style or a Template in app.xaml for TargetType=GridViewColumnHeader so any columnheader in any listview in the project would response to the method in app.xaml.cs? ...

WPF Writing custom Control

I wanted to write a Custom Control that would show a family tree... so i looked on FamilyShow.... So their control inherits FrameworkElement but then every thing gets super complex... are there any easy tutorials out there that show how to implement a custom FrameworkElement with children and so on? Basically what i fail to do is this,...

Problem with InlineUIContainer

I have an Windows.Documents.InlineUIContainerin a RichTextBox, and sometimes it's font size of alignment change when I hit key combination such as Ctrl+Space. I couldn't find any place to handle these events and block them somehow. I don't want to block it in the RichTextBox. I am more looking for a way to block it only on the InlineUICo...

Item rendered via a DataTemplate with any Background Brush renders selection coloring behind item.

I have a ListBox which uses a DataTemplate to render databound items. The XAML for the datatemplate is as follows: <DataTemplate x:Key="NameResultTemplate"> <WrapPanel x:Name="PersonResultWrapper" Margin="0" Orientation="Vertical" Background="{Binding Converter={StaticResource NameResultToColor}, Mode=OneWay}" > ...

Proper way to structure a Sync Framework DAL

I am creating a WPF app that needs to allow users to work in a temporary disconnected state and I plan to use a Local Database Cache. My question's are about my data access layer. Do you typically create the whole DAL to point at the Cache or both and create a switching mechanism? Is Entity's a good way to go for my DAL against the ...