wpf

Performance penalty of typecasting and boxing/unboxing types in C# when storing generic values

I have a set-up similar to WPF's DependencyProperty and DependencyObject system. My properties however are generic. A BucketProperty has a static GlobalIndex (defined in BucketPropertyBase) which tracks all BucketProperties. A Bucket can have many BucketProperties of any type. A Bucket saves and gets the actual values of these BucketProp...

Cannot resolve symbol T

I have a problem with ObservableCollection Class. I cant resolve this. using System.Collections.ObjectModel; #region ViewModelProperty: CustomerList private ObservableCollection<T> _customerList = new ObservableCollection<T>(); public ObservableCollection<T> CustomerList { get { return _customerList;...

Get font information from FormattedText in WPF

I have FormattedText object, how can retrieve it fonts information like what range has which font like . ObjFormattedText.GetFontSize(istartIndex,iendIndex). ? ...

WPF animation to expand-contract height

Hey I would like to have a trigger on an image which expands AND contracts an ItemsSource by animating its height property. I have a generic ItemsSource bound to a ObservableCollection, so I do not know the total height of this control. Once the image is clicked, it should change its image source glyph to show that the itemssource is ...

DataSource reflected after maximizing the window in wpf

Hey, This is really peculiar. I tried a simple data binding example program. I tried to bind a collection (IList) to a list box. When i alter the collection, the list box is updated only if i maximize the window. Here are the snippets, <ListBox x:Name="myBirthdaysListBox" ItemsSource="{Binding}"> <ListBox.ItemTemplate> ...

wpf layout question

<Window ... > <StackPanel> <Button>b1</Button> <Button>b2</Button> </StackPanel> </Window> how to make this look like this: <Window ...> <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Butto...

wpf datagrid extra column in header on left

I keep getting this button in the header, I can click on the button to select all rows. This misaligns the data from the header. Any ideas? Thanks in Advance. Datagrid image via link: http://picasaweb.google.com/lh/photo/CahvlINknhL5ykIW2zCfIw?feat=directlink <dg:DataGrid.Columns> <dg:DataGridTextColumn Header="Description" Widt...

WPF RichTextBox tab selection eating up system memory!

Hi I have a TabControl in WPF / MVVM that is bound to an ItemsSource on top of an ObservableCollection. Each tab has its own collections and bindings with components such as Images, Richtextboxes, and user input boxes, and everything seems to work well. However, I have noticed that each time I switch a tab, it uses about 100k of syste...

wpf set ComboBox selected item highlight color

Hello! I need to change the highlight color of a ComboBox's selected item in the popup list. I've found several tutorials explaining how to do this, but all of them either use Blend, which I do not have and cannot obtain, or involve changing the system default colors--which seems like a hack to me. Can someone point me to the template...

type fidelity using WCF/WPF over internet

We are trying to come up with an architecture approach for designing an application where front end runs as a browser based xaml app. this app contacts services on the web server that are built using wcf, the wcf services host domain model that uses nhibernate for persistence (so it is hibernate aware by using interfaces for lists and s...

Programatically set the Keyboard.Modifiers (WPF)

Has anybody found a way to set the Keyboard.Modifiers via code in WPF? Only a getter is exposed, so there must be some other way to do it that I'm just not seeing. ...

WPF Images don't display when View is switched out

I have the following WPF application <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="Window1" Height="300" Width="300"> <Grid> <TabControl> ...

How do you set the FrameworkElement.Width property to the value of a qualifiedDouble, in the code-behind?

I'm trying to set the width property of one of my controls to a qualifiedDouble, as described here on MSDN. (Scroll down to the "XAML Values" section to see MSDN's info on the use of a qualifiedDouble) However, I want to know how to achieve this in the code-behind, rather than XAML. The UserControls I am creating do not have XAML atta...

WPF - forms controls don't appear if you have AllowsTransparency set to true

I have an application that I use with AllowsTransparency set to true to allow me to make my window have rounded corners and no windows bar on top. I recently needed to added the use of a windows form control but the control will only show if I set the AllowsTransparency back to false and that then changes the whole look of the applicati...

wpf minimize the width of a ToggleButton

Does anyone know a good way to minimize the width of a ToggleButton to only the width of the content plus padding? I've found 500 posts on how to make it stretch, but none for keeping it from stretching to fill the available space. ...

Find an element in DataTemplate applied to TabItem

Hi all, I got a problem trying to find an element declared in DataTemplate, that after was applied like a ContentTemplate to TabItem object. I saw that there is already some solutions in regard of this problem, but no one of them actually works in my case, and I would like to understand why (obviously I make mistake in some place) Here ...

What MVVM framework are you using?

I am looking to write a WPF app and am trying to pick a MVVM framework to handle some of the complexity. What would you recommend and where can I find a good tutorial/getting started guide for said framework? ...

How can I sort a ListBox using pure xaml and no code behind?

I need to sort the strings in a ListBox, but it is bound to the view model by another component via the DataContext. So I can't directly instantiate the view model in xaml, as in this example, which uses the ObjectDataProvider: http://www.galasoft.ch/mydotnet/articles/article-2007081301.aspx in my xaml: <ListBox ItemsSource="{Binding ...

Binding to a RoutedUICommand that's not in the codebehind.

I have a static class which contains a RoutedUICommand that I would like to use in binding. public static class CommandLibrary { public static ProjectViewModel Project { get; set; } public static RoutedUICommand AddPage { get; private set; } static CommandLibrary() { AddPage = new RoutedUICommand("AddPage", "Ad...

Style on ContentPresenter is not working for TargetType (HeaderedContentControl)

So, everywhere I read you can embed a style on a ContentPresenter.Resources and it will automatically apply it to any object that are of the TargetType. So I have the code below. Simple. But it does not work. Cannot figure this one. Any help?? <UserControl.Resources> <Style TargetType="TextBox" x:Key="MyStyle"> <...