wpf

databinding to XML in XAML: How to append new XmlNode?

Hi, all I found so far about databinding to XML always only seems to be binding to a fixed XML structure. Would be nice, if anyone could point me in any direction, everything I tried so far seems very awkward. This is what I would like to do: Binding the Checked state of a Checkbox to a node within the XML. So it is checked if this sp...

WPF - Drag & Drop on Listbox ITEM

I want to drop something not on the whole ListBox, but on a specific ListBoxItem. I'm handling the ListBox' Drop event - how can I find out, on which item the mouse is pointing? ...

WPF Putting a Button on a Label

I've got a listbox of Labels, each bound to a LabelName and LabelColor. I want to add a small button that resembles an "X" and attach it on the right side of the Label. I want it to look seamless, like the X is very non-intrusive. Any ideas how to do this? The stuff between the <Label.ContentTemplate> does NOT work. I don't even want it ...

Setting Canvas to a control template?

I have a Canvas in a ResourceDictionary xaml file like so: <Canvas x:Key="Icon"> <Path ... /> <Path ... /> </Canvas> In my code-behind I load this icon using LayoutGrid.Children.Add(FindResource("Icon") as Canvas); And this works fine. Now I want to create a button that uses the same icon as a template. So I create a cont...

WPF: DataBinding a ListBox where each item is a Tab Stop

I just built a WPF form that contains a ListBox. The ListBoxhas bound to it a list of TextBox controls. I need to make each TextBox control a TabStop so that a user can hit tab, type in a number, hit tab again and type in the next number, etc. Problem is, the ListBox itself catches the tab then the next tab skips to following control af...

Problem with text input in textbox control

I'm working in a WPF project, which basically is a class library project that implements the MVVM pattern. For clarity purposes I'm gonna say that I just have a single window with a single textbox control on it. Now, I'm adding this dll to another project, which is a Windows Forms project, and I'm calling the window with the textbox co...

WPF how to show an Image.Source (BitmapSource) pixel position?

Let's suppose I've got an image which shows its source in a scaled way, how could i use a MouseMove event to show in a label or textblock the pixel position in which the cursor is? (I need the pixel coordinates not the coordinates of the image relative to its size) Thanks in advance. ...

Set System.Windows.Controls.WebBrowser's content to a static HTML literal?

Hello! I want to set up inline content of a WPF WebBrowser control: <WebBrowser> <html> <body><b>Inline content.</b></body> </html> </WebBrowser> Or alternatively: Dim wb As New WebBrowser wb.Content = "<html><body><b>Programmatic content</b></body></html>" ...

How can I desaturate selected rows when DataGrid is out of focus?

The normal convention for UI controls is for selected text, items, or rows to be brightly colored (e.g., bright blue) when the parent control is in focus and desaturated/dim (e.g., pale blue) when the control is out of focus. In contrast to the ListView/GridView, the WPF DataGrid control does not follow this convention by default. Selec...

WPF: Can't drop dragged data onto an ItemsControl

I have the following XAML: <DockPanel x:Name="OverViewContainer" AllowDrop="True"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> <uicommon:Toolbar DataContext="{Binding Commands}" /> </StackPanel> <ItemsControl ItemsSource="{Binding DocumentE...

How to implement Touch Screen functionality in WPF

Hi, I am using WPF 3.5 on Vista Machine. Can someone please let me know how to implement touch screen functionality on this. A demo example will be really helpful. Thanks, Sachin ...

How to load file icons in a background thread [WPF]

my code extracts file icons(or even thumbs). however if i have many files it may take a while. I've tried to use background thread to load icons. Bitmap created from icon extracted form file and stored in list. It seems that for each native bitmap it handle exist only in owner thread (that is in thread where bitmap created). In UI thr...

How to make WPF ToolTip follow mouse

I have a Bitmap image that displays a ToolTip. The image is the handle for a custom built slider control. The purpose of the tooltip is to display the exact number that the slider handle is currently positioned on. Im looking for a way to make the tooltip "follow" the mouse. The following attributes have been set: ToolTipService.Betwee...

Transpose a Collection

Hello, I've a list of different sizes of a T-Shirt, e.g. S, M, L. Since this might change for T-Shirts (sometimes we just have e.g. M, L), we load this into a List sizes. Since most DataGrids (xamDataGrid, WPF Toolkit DataGrid) need Properties for binding to the Columns, I'd like to transpose somehow my data. Does anyone have an idea h...

How to access Drag-EventHandler from external class

Hi! I have a UserControl that contains another UserControl. Like this: <HeaderedContentControl Grid.Row="2" Header="New A" DataContext="{Binding NewA}" Template="{StaticResource NewAResource}"> The outer UserControl has elements which I can drag. The embedded UserControl has a TextBox to which I want those elements to be ...

WPF wrappanel item alignment problem when scrolling

Someone help me out pls. I set a wrapPanel in a listbox itemPanelTemplate, Also, I already set the ScrollViewer.CanContentScroll="True". But why the listbox items are not scrolling up/down by ITEM one by one? The scroll style is still by PIXEL. Is anyone help me? <Grid> <ListBox x:Name="testListbox" ScrollViewer.CanContentScroll...

How to move a WPF Popup?

I have a Popup defined like this: <Popup Name="myPopup" StaysOpen="True" Placement="Bottom" PlacementRectangle="0,20,0,20" PlacementTarget="{Binding ElementName=myPopupAnchor}"> <TextBlock ... /> </Popup> I have added event handlers to the myPopupA...

get RibbonCommand Name from sender Object that is executed

How to get the Label of Ribbon command that is executed. Information is present in sender object but how to cast it in RibbonCommand and then I can get that command name private void RibbonCommand_Executed(object sender, ExecutedRoutedEventArgs e) { RibbonCommand rbnCmd = sender as RibbonCommand; } But in this case rbnBmd remains...

Conditional Data Templates in WPF

How would it be possible to choose a different datatemplate accroding the a field in the data binding source? I would have 2 different DataTemplates <DataTemplate x:Key="DataTemplateLabel"> <Label Width="60" Height="25" Background="Red"> <TextBlock Text="{Binding Path=Name}"/> </Label> </DataTemplate> <DataTemplate x:Key=...

Can I pass data from Winforms to WPF Control?

I have a winforms app but I would like to introduce a WPF user control into the app as a taster for further WPF implementation. This control needs to receive from its Host a single piece of information, a string. How can I pass this down from the Winforms app to the hosted control? Or, indeed, can I? ...