wpf

How can we retrieve Xps document headings in WPF?

Hi, How can we retrieve headings or chapter names from the xps document in WPF using C#? We can get the TextSelection from the xps document from the below code. Type t = docViewer.GetType(); PropertyInfo inf = t.GetProperty("TextSelection", BindingFlags.Instance | BindingFlags.NonPublic); But, Is there any way or propert...

Why would a TextBlock with DropShadowEffect show a solid black background on one XP machine?

We have a WPF application in which we have the following XAML: <TextBlock x:Name="HeaderRightSubtitle" HorizontalAlignment="Left" VerticalAlignment="top" FontSize="10" Foreground="#FFFFFF"> <TextBlock.Effect> <DropShadowEffect Color="#FFCACACA" ShadowDepth="1" Opac...

WPF RichTextBox memory leak

In my application, I have a lot of RichTextBoxes that are created dynamically in run time. I realized that the application has a memory leak, which is caused by the RichTextBox controls. To prove that the memory leaks because of the control I wrote the following test method: for (int i = 0; i < 3000; i++) { Control r...

Adding controlpoints to polyline

I have an existing Polyline. How I can add a control point on it? In other words I need to add a control point on the LineSegment where I click with mouse. I use WPF. Can anybody help me? ...

What is the WPF control that VS2010 uses for the code editor?

What is the WPF control that VS2010 uses for the code editor? Some time in the past, I tried to use the 1st WPF version but it performed very bad. Seams like the performance in the .NET 4 is far better. My question is actually related with the fact that I'm very unhappy with the editors available for Windows and want to try made one by...

Windows App Focus: Why does it require a click?

When I have 2 apps open and one has the focus but I want to execute a command in the other app, it requires a click to regain focus and another to execute the command. Is there some good reason why I couldn't take focus on MouseOver? I'm working with a WPF app if that is pertinent. TIA EDIT: Oddly enough the MouseOvers work without ...

WPF XPath Binding With Multiple Results Converted to Comma-Delimited String

I have an XML file similar in structure to the following: <Parent> <Child>5</Child> <Child>3</Child> <Child>5</Child> <Child>1</Child> </Parent> In my XAML, I have a ListView bound to the XML file and have set the DataTemplate of a ListViewItem to be bound as follows: <TextBlock Text="{Binding XPath=Parent/Child}"/> ...

.NET delegate equality?

I think this is the question, anyway. I am using a RelayCommand, which decorates an ICommand with two delegates. One is Predicate for the _canExecute and the other is Action for the _execute method. ---Background motivation -- The motivation has to do with unit testing ViewModels for a WPF presentation. A frequent pattern is that I hav...

Move focus in response to keyboard events in XAML

I've got a WPF view with two textboxes. I'd like to automatically move focus forward from the first textbox to the second when the user hits the down arrow on the keyboard exactly like Tab does. It seems like I ought to be able to do this 100% declaratively, but for some reason the commands I thought would do this don't seem to do anyt...

Pre-sorting a DataGrid in WPF

I have a DataGrid in WPF app with several columns, including a Name column. If the users switches to a particular view, I want the data to be pre-sorted by Name (and I'd like a sort arrow to appear in the Name header just as if the user had clicked that header). However, I can't find the expected properties to make this happen. I was loo...

Unwanted dotted-line selection aroudn empty text for WPF RadioButtons

Hi, I have two radio buttons next to each other, and even though each one has no Content/Text, there is this ugly little dotted-line box that shows up next to which ever one has the focus (I think it wrapping the place where text/label would normally be). Can I get rid of this? ...

WrapPanel not wrapping when in a StackPanel with Horizontal orientation.

The labels in the example below (WPF/XAML) just parade off the screen, no wrapping occurs. Removing the orientation works, but doesn't provided the needed functionality/look & feel. Any ideas how to make the wrap panel wrap to the current size of the StackPanel? <Window Height="300" Width="600"> <StackPanel Orientation="Horizontal...

In WPF, accessing containers within ListBox

I'm creating a DerivedListBox : ListBox and a DerivedHeaderedContentControl : HeaderedContentControl, which will serve as a container for each item in the ListBox. In order to calculate the size available for the expanded content of the DerivedHeaderedContentControls, I am storing each container object in a list within the DerivedListBo...

WPF: Custom ListBoxItem with DataTrigger

I have a WPF List Box containing CheckBoxes. I would like the text colour of the text box to change to red when the ViewModel notices that the bound value is now updated. I have the below XAML but it is not working. I can see the IsUpdated property being queried but when the value is True the colour is not changing. I'm sure I'm miss...

Get font name from FontFamily in WPF

I'm currently working on a little font organization/preview application for myself, however, I'm having a hard time getting the exact information I need. I've found that I can load an external font by just creating a new FontFamily object with the font's file location as its source. However, I can't find a way to get a font's specific f...

WPF problems with trigger syntax

I can't get the following to work. The goal is to change the ZIndex of the usercontrol when the mouse is over its content. Using a simple property like "Background" instead of ZIndex does not work either. The compiler complains about "Value 'Grid.IsMouseOver' cannot be assigned to property 'Property'. Object reference not set to an ins...

How to put a C# programm (ex WPF or WF or with Mono) under desctop Icons (like a wallpaper)?

How to put a C# programm (ex WPF or WF) under desctop Icons (like a wallpaper)? I want my Old Good XP Active Desktop made by a some open source C# programm on my Win 7!) Something like this - Fences . They have there "windows" appearing underneath icons. I do not want to manage Icons - just put my window under them... BTW any one know...

Silverlight Automation Similar to Watin

I am considering porting a WPF application to Silverlight. However, the WPF application uses Watin to spawn IE processes and automate certain tasks. My question is if there is a way to automate tasks in Silverlight by spawning popups and performing tasks in them similar to how you would with Watin. ...

WPF DataGrid - Set a cell into edit mode programatically

I have a WPF DataGrid that shows some data records (bounded to an ObservableCollection). When the user clicks "Edit" button, the currend selected row should move into edit-mode (As if the user double-clicked this row). Any idea of someone who knows how to do that ? ...

WPF: binding seletion of text to sliders?

In a WPF based project I would like to bind the content of a TextBox to two sliders in such a way that first slider would start selection (from left or right based on a checkbox) from the n-th character (n being slider value) to the m-th character (based on second slider value). In essence I would like to specify selection range based on...