wpf

Tabbing or Deselecting Cell not Committing Data

Hey there, I am working with the the WPF Toolkit DataGrid and currently have a problem with committing data back to the source. My grid is bound to a CLR object list and I have a converter with both the convert and convert back methods implemented. The two way binding works fine if the user hits Enter in the cells but if they deselect...

How to get the selected index of MVVM-bound radiobuttons?

I have an ItemsControl which is bound and set to an observablecollection in my viewmodel: <ItemsControl ItemsSource="{Binding AwaySelection}" > <ItemsControl.ItemTemplate> <DataTemplate> <RadioButton Content="{Binding AwayText}" ></RadioButton> </DataTemplate> <...

Using HierarchicalDataTemplate.Triggers to affect controls in the ItemTemplate

I have a treeview with a HierachicalDataTemplate (shown below) bound to a datarelation in a dataset. The parent nodes represent parent parts and the children represent parts that make up the parent. In some cases the user will check the checkbox at the parent level to indicate they are replacing the entire part with all its children. At ...

Collision detection using MeshGeometry3D....

I am creating a CAD like program, creating modelvisual3D objects. How do i do collision detection between my objects(modelvisual3d) using MeshGeometry3D. Do i have to compare every triangle in the moving object against the still standing objects? What will be my best way to do collision detection? ...

Precise OpacityMask

Suppose I need to set an opacity mask on a WPF control that highlights a portion of it in precise position (suppose a 50x50 square at (50;50) position). To do that I create a DrawingGroup containing 2 GeometryDrawing objects: 1 semi-transparent rectangle for the whole actual size of the control and 1 opaque rectangle for highlighted area...

How to create a data template dependent on an XML Attribute?

I'm working on a WPF interface that reads an XML file and displays the data. The XML file would be something like this: <People> <Person Gender="Male"> <Name>Joe</Name> </Person> <Person Gender="Female"> <Name>Susan</Name> </Person> </People> I need a data template dependent on the Gender attribute of ...

Font size mismatch between RichTextBox and Word

I have a small WPF application that hosts a RichTextBox: <RichTextBox SpellCheck.IsEnabled="True" FontFamily="Verdana" AcceptsTab="True" AcceptsReturn="True" FontSize="14" /> As shown the code snippet above, I set the font size to 14. If I copy text from this RichTextBox to Microsof...

Detect when WPF listview scrollbar is at the bottom?

Is there a way to detect if the scrollbar from the ScrollViewer in a ListView has reached the bottom of the virtual scroll space? I would like to detect this to fetch more items from the server to put into the bound ObservableCollection on the listview. Right now I'm doing this: private void currentTagNotContactsList_scrollChanged(obj...

Problems with WPF application on Windows XP Tablet having memory leaks

I am testing an application that was developed in C#, .Net 3.5 SP 1, and WPF. It runs just fine on all kinds of hardware running XP. Including really old 386's with little memory and slow hard drives. However, we are having problems with Windows XP Tablet PC Edition 2005 SP 2. We are seeing what looks like a memory leak, which we h...

Is there a *clean* way to make a read-only dependency-property reflect the value of another property?

The code below is my current solution. If it takes you a couple minutes to figure out what this code is doing, I hear ya. This is an ugly mess if ever there was one. I would kill to see an alternative, (but don't let that discourage you from responding... :-). Oh jeez, I even abbreviated it (substantially) by removing the converter...

Why is the Button's Background changing?

I'm a rank beginner with WPF and I don't even know where to look to find the answer to this question. This XAML seems very straightforward to me: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Button> <Button.Style> <Styl...

A pure Xaml solution for setting a property to a value when a button is clicked?

Hi, In my app, I'd like to make the context menu of a button appear when the user left clicks on the button. I can do this by creating an event handler for button's click event and then setting it's context menu's IsOpen property to true, but I'm wondering if there's a pure xaml solution to do the same thing. Any ideas? Thanks! ...

General Design Question about data binding in WPF

Hi, I'm starting to use Binding in my WPF project and I'm actually confused about few things on the presentation side (XAML). So I want to populate a tree view with a List of Categories. I know how to write the right HierarchicalDataTemplate for my List of Category instances. <HierarchicalDataTemplate ItemsSource="{Binding Path=Chil...

How to declare a static hyperlink for a WPF Toolkit DataGridHyperlinkColumn?

I am using the WPF Toolkit's DataGrid, and I need one of the columns in the grid to display a hyperlink with static text that will just call an event handler in my code. I don't want any data binding going on with this link, just the link itself displayed with static text for each record, e.g. "Delete". (The underlying purpose of the l...

How to override a global style (that doesn't have an x:Key), or alternatively apply a named style to all type-targeted controls?

Hello all! I declared a style that I want to apply to ALL the buttons in the project, the style resides in the ResourceDictionary: <Style TargetType="StackPanel"> <Setter Property="Orientation" Value="Horizontal" /> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>...

Padding on StackPanel?

Hello folks! I am trying to set padding of a StackPanel but there ain't such property. I tried StackPanel.Border, but there is no such property either. Any ideas? ...

What is the difference between Silverlight and XBAP?

What is the difference between Silverlight and XBAP? Where would you use one vs. the other? ...

How to bind combo box with dataset in WPF

Hi, I want to bind the combo with dataset and take the value from combo as parameter to populate another combo in WPF ...

Cannot convert string 'RenderTransform.(TranslateTransform.X)' in attribute 'TargetProperty' to object of type 'System.Windows.PropertyPath'. Property path is not valid. Cannot resolve type name 'TranslateTransform'

Hello folks, I am applying DoubleAnimation on framework element at runtime. Here is the code snippet foreach (FrameworkElement objInnerElement in objFrameWorkElement) { Point ElementPosition = new Point(Canvas.GetLeft(objInnerElement), Canvas.GetTop(objInnerElement)); Double...

Alternative of blur effect on DrawingVisual

I want to give a blur effect to my DrawingVisual. I can do this using BitmapEffect properties like: DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); var effect = new System.Windows.Media.Effects.BlurBitmapEffect(); effect.Radius = 10; drawingVisual.BitmapEffect = effect; Bu...