wpf

WPF Slider problems

I have seen this behaviour, on an old win32 app, where when you hold down the mouse at some position on the slider track (other than on the thumb), the thumb moves to that position. In WPF what seems to be happening is the thumb moves a distance defined either by SmallChange or LargeChange. If you keep holding, it moves by SmallChange/...

Ellipsis at start of string in WPF ListView

I have a WPF ListView (GridView) and the cell template contains a TextBlock. If I add: TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" on the TextBlock, an ellipsis will appear at the end of my string when the column gets smaller than the length of the string. What I need is to have the ellipsis at the beginning of the string. I....

Change databinding on WPF ComboBox when Checkbox value changes

I have a WPF ComboBox which is databound to a Collection, but depending on wether a Checkbox is checked or not I'd like to vary which Collection the ComboBox is bound to. The basic issue is I have a large collection of MyCustomer and I also have a filtered collection of MyCustomer - the filtering is quite intensive and I don't want to d...

Keyboard events in a WPF MVVM application?

How can I handle the Keyboard.KeyDown event without using code-behind? We are trying to use the MVVM pattern and avoid writing an event handler in code-behind file. ...

Programmatically create WPF DataGridTemplateColumn for DataGrid

I would like to be able to programmatically create DataGridTemplateColumns based on my data source. For example, if my source has a date in a particular column I would like to be able to utilize a Datepicker control. I know this is easily accomplished with xaml and a DataGridTemplateColumn at design-time, however, how would I accomplis...

Call XAML animation from VB code in WPF

Guys, here's what I'm trying to do: I have a Storyboard animation for an object done in Expression Blend. What I need is to be able to trigger that animation from the VB.net code. Any ideas? Thanks, ...

Debug error when calling a Storyboard to Start.

I have some storyboards in XAML (WPF Project) and I´m calling them from the VB code with this: Dim ServiceOff As Storyboard = DirectCast(FindResource("ServiceStopped"), Storyboard) ServiceOff.Begin() I´m getting the following error when trying to build: Overload resolution failed because no accessible 'Begin' accepts this number o...

Is it possible to convert an ASP.NET control to a picture on the fly?

In ASP.NET, If I have an multi-line text box (or even a 3rd party rich text box), can I convert its content to a picture during postback? By convert I mean to keep the format & content in the picture. For example, I have a rich edit box, end user can add fancy text font and symbols directly on it, once they hit "submit", is there a way...

How to let an Expander expands upward

I have a dataGrid and an expander as follow. <Grid> ... <DataGrid ....> <Expander ...> </Grid> I want the datagrid as big as possible and expander as small as possible at the begining. When a user click expender, the expander expands upward instead of downward. and the datagrid shrink. Thanks! ...

WPF ListBoxItem Not Filling

In a listbox, when I select an item I still get some kind of border or space around my listboxitem creating the line you see in the image. I want to remove that line I put a circle around. It already has HorizontalContentAlignment = "Stretch" by the way. What am I doing wrong? The problem: ...

Binding to an auto-updating object?

Is there an object or interface I can use to make an auto-updating object, and have those updates filter through to the UI in WPF? Basically I'm looking for something like this: <TextBlock Text="{Binding Source={StaticResource myClass}, Path=DataObject}" /> public class MyClass { public AutoUpdatingObject DataObject { get; set; } ...

Prism v2: seeking clarification on why modules need to "register view types with the shell"

I'm reading through the Prism v2 guidelines in which they state: During initialization, modules use the RegionManager to locate regions in the shell and add one or more views to those regions or register one or more view types to be created within those regions I understand that views are added in the bootstrapper e.g. in...

Customizing The DependencyObject Inheritance Tree

I'm struggling to find sufficient information about the property Inheritance Tree (or Inheritence Context) used by DependencyObject and DependencyProperty. I would like to use the value inheritence capability of DependencyProperty outside of a typical WPF page, such that Object A is the logical parent Object B, and thus a value assigned...

WPF Trigger for IsSelected in a DataTemplate for ListBox items with Blend

I wanted to change the Foreground color when I selected a listboxItem and I did it using this bit of code: <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True"> <Setter TargetName="descriptionTB" Property="Foregrou...

WPF - Accessing the BackStack property of Frame from inside the frame

I have a Page which is loaded inside a Frame element via it's Source property. I need to get access to the Frames .BackStack property from the source xaml's code-behind... Is that possible? so roughly the code is - <Frame x:Name="contentFrame" Source="ProjectsPage.xaml"/> in the ProjectsPage.xaml.cs i want to access properties on i...

How do I allow multiple items/content for a user control in WPF?

I've managed to get as far as redirecting content to my stackpanel as shown: <UserControl x:Name="taskItem"> <UserControl.ContentTemplate> <DataTemplate> <StackPanel> <Label x:Name="labelHeader" Content="{Binding ElementName=taskItem,Path=Header}" FontFamily="Tahoma" FontSize="16" FontWeight="Bold" /> ...

WPF Window created from WinForms sometimes stops redrawing

I have a borderless, topmost, clickthrough WPF window that's used to display a notification message to the user that appears and then fades away, and it's created from a WinForms app when I click a button (this is a test project). Clicking the button multiple times creates several instances of this window. Most of the time it seems to...

WPF, UserControl, and Commands? Oh my!

(This question is related to another one, but different enough that I think it warrants placement here.) Here's a (heavily snipped) Window: <Window x:Class="Gmd.TimeTracker2.TimeTrackerMainForm" xmlns:local="clr-namespace:Gmd.TimeTracker2" xmlns:localcommands="clr-namespace:Gmd.TimeTracker2.Commands" x:Name="This" DataC...

Display "Wait" screen in WPF

I am trying to display a please wait dialog for a long running operation. The problem is since this is single threaded even though I tell the WaitScreen to display it never does. Is there a way I can change the visibility of that screen and make it display immediately? I included the Cursor call as an example. Right after I call this.Cu...

How to get TreeViewItem from HierarchicalDataTemplate item?

I have a TreeView which uses a HierarchicalDataTemplate to bind its data. It looks like this: <TreeView x:Name="mainTreeList" ItemsSource="{Binding MyCollection}> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type local:MyTreeViewItemViewModel}" ItemsSource="{Binding Children}"> <!-- code code cod...