wpf

WPF - Drag & Drop file extract icon and convert to bitmap (show on button or other object)

I'm working with WPF, and trying to implement a form to receive a Drag and Drop link, and assign to a button on a record (attach links to files to a record). I can get the link path with no issue. I'm stuck trying to extract the icon file from the link, and convert and render it. private void frmMain_Drop(object sender, DragEventA...

Listboxes, scrolling in sync

Hi Everyone, I have 2 listboxes, same size, next to each other. Basically I am using them to represent linked items...Similar to having 2 columns and a number of rows in excel, with say, first name in one and last name in the other. I am wondering if I could make it so that when one listbox is scrolled, the other listbox scrolls in syn...

WPF Grid with XmlDataProvider and ContentControl?

What is wrong with DataTemplate x:Key="CellTemplate" not reaching the DataContext of the Grid's ContentControl? <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="WpfApplication1.Page1"> <Page.Resources> <XmlDataProvider x:Key="x...

Command Binding Memory Leak in WPF

When i create a user control that has a CommandBinding to a RoutedUICommand im worried that i get memory leaks. scenario: Have a RoutedUICommand as a static in c class where i store my commands Implement the CommandBindings on a user control. Add the user control to the main form. Remove the user control from the main form, set the re...

How do you calculate the offset to the client area in WPF?

I want to position a modal dialog (progress window) at the top right corner of the parent window client area. This code will put it in the corner of the non-client area, but how do I calculate the offset to the client area? this.Owner=owner; this.Left=owner.Left+owner.ActualWidth-Width; this.Top=owner.Top; Edit: I found this 'soluti...

How to stop queuing of operations on a control?

Hi, I have a tab control in the WPF application. Inside the tabcontrol each tab item consists of so many check boxes and buttons. Each check box when it is clicked, in background with a new thread, some operation is going. Till that completes tabcontrol's isHitTestVisible is made false, so that any other click should not happen. But now...

How to start a WPF application from a web service ?

Hello all, a web service is running with IIS. When calling the initialize service, some libraries are dynamically loaded in order to start a wpf application. The code compiles, runs... but the window never shows up. No exception is thrown whatsoever. Below is the code that is executed to create the WPF application: public void Start(...

Set value of hyperlink with WPF by code

Hi all, I'm using WPF and an Hyperlink control with <TextBlock Margin="98,190,116,133.418" FontSize="14"> <Hyperlink Name="hyperlink" RequestNavigate="Hyperlink_RequestNavigate"> Click here </Hyperlink> </TextBlock> this is working, but I would like to set the "click here" value by code, but I'm u...

WPF Formatting text in a TextBlock bound to a string

I have a custom control which has a string Description dependancy property as shown below: <CustomControl> <CustomControl.Description> Hello World </CustomControl.Description> </CustomControl> This description is bound in several places in TextBlock's as shown below: <Button> <Button.ToolTip> <TextBlock Te...

Stop Dragging from a WPF WebBrowser control

I have a WPF application which contains a WebBrowser control. Currently, the user can select something within the WebBrowser and can copy the content by dragging it out to another application and dropping it there. I'd like to be able to stop the user doing this. I'd assumed that there would be a "DragStart" event that I could capture...

How can I hide the Windows 7 logo in the taskbar?

I have a WPF window that goes fullscreen, and I have made every attempt to make it truly fullscreen. WindowStyle is None, WindowState is Maximized, Topmost is true, etc. I even used p/invoke to hide the taskbar when the window is loaded and make it appear again on exit. The problem I have is when, for example, I play a video that replays...

Databinding mode Explicit

Hi All, I've got a listbox that contains a list of objects (lets say addresses) The list box items source is bound to this observable collection <ListBox x:Name="listDetails" ItemsSource="{Binding}" ... Then i've got a text box, this is bound to the name fild of the current object <TextBox x:Name="textBoxName" Text="{Binding Name...

How do I access Windows Media Player Library programmatically in C#/WPF?

I need to access and present the information from Windows Media Player library, from my C#/WPF application. How do I do this programmatically in C#/WPF? ...

WPF: ItemsControl with scrollbar (ScrollViewer)

I followed this small "tutorial" on how to add a scrollbar to an ItemsControl, and it works in Designer view, but not when I compile and execute the program (only the first few items show up, and no scrollbar to view more - even when VerticalScrollbarVisibility is set to "Visible" instead of "Auto"). Any idea on how to solve this? Th...

Linq Datacontext and "unit of work"

The buzword in Linq now days is "unit of work". as in "Only keep your datacontext in existence for one unit of work" then destroy it. Well I have a few questions about that. I am creating a fat client WPF application. So my data context needs to track the entire web of instantiated object available for the user on the current screen. ...

FormattedText Width property does not take trailing spaces into account

I am using System.Windows.Media.FormattedText to do some low level rendering (specifically, trying to render math equations in a typographically pleasing manner). For this, precise metrics on the text blocks I am using are critical. I am creating several FormattedText objects and using these at the lowest level of rendering. The proble...

Why is ListCollectionView.CustomSort so slow?

I have an ObservableCollection of ViewModels that are sitting in a WPF DataGrid. The DataGrid has three columns: Position column; this is rendered at runtime by a UserControl that displays the position of the row in my DataGrid Name column; this is rendered at runtime by a UserControl that displays the name of the column (yes, I need a...

WPF: Creating snappable grid lines with variable spacing

Hi! I'm currently creating a MSPaint-like WPF-application and struggling with the implementation of a snappable grid. The painting of the grid is no problem with a VisualBrush and a Rectangle but the problem is that these lines are then purely for looks and can't be easily changed (for example highlighted when the snapping to a specif...

(VB.NET + WPF) Drag + Drop (to allow user sorting) of stackpanel elements within a Scrollviewer?

I have good model (I think!) for how to allow a user to drag an element in a stackpanel and reposition it to another location within the stackpanel. However, my Stackpanel is placed within a ScrollViewer, like this (generalized): <ScrollViewer> <StackPanel> ....First item ....Second item ....Third item ...

How to reference ObservableCollection from WPF ListView SelectionChanged event handler?

In WPF app I have a ListView which is connected with ObservableCollection ShQuCollection through databinding: <ListView Name="ShSelList" ItemsSource="{Binding Source={StaticResource myDataSource},Path=ShQuCollection}" SelectionChanged="ShSelList_SelectionChanged"> <ListView.View> <GridView> <GridViewColumn Header="Co...