wpf-controls

WPF DataTemplate and Binding - Is this possible in xaml ?

I am DataTemplating a listbox's itemsource to display a series of comboboxes. I want to give the 'DisplayMemberPath' of the combo to a property, which is in a different source than its own 'ItemsSource'. (Assuming DisplayMemberPath is just a string representing name of a property, I am getting this from the user). I have achieved this wi...

Visual Studio C#, WPF controls

Hi guys. I'm making a simple program in Visual Studio C# for school and I'm using the WPF Controls. I'm making some type of monthly report that I need to visualize in a table with the columns that represent the days. The problem is that I don't know which control to use. I tried with with the ListBox but it does not give a good result ...

WPF - Creating a dynamic datagrid in xaml by datatemplate

I am trying to create a DataGrid by datatemplates. The reason is I want the columns to be dynamically created but all in xaml and not in code behind. I get a List based on which I want to create my grid columns in xaml. class GridColumnElement { public string HeaderCaption { get; set; } public string PropertyName { ...

How can I put a return string value in the Text property of a text block?

Let's say I need to display the appliation version which is returned by a static method: I don't know the syntax to called a static method or whether it is possible to do so. Please help. ...

WPF - Change the place of a control in a grid in code-behind

Is it possible to change where a control is placed in a grid from code-behind? For example, if I have a Button in Grid.Row="1", can I change that to Grid.Row="0" from code-behind? ...

WPF positioning take full height of window

Here's my layout. <Window> <StackPanel Orientation="Vertical"> <StackPanel HorizontalAlignment="Stretch" Height="30"> </StackPanel> <Canvas HorizontalAlignment="Center" Width="1020"> <!--i want this to take the remaining full height of the screen--> <Canvas x:Name="bottomInfo...

Writing <period> in my TextBox should perform tab

When I write a <period> into myTextBox I want a myOtherText.Focus to be performed. Anyone know a way of doing this in xaml code? Edit:Agree that the orginale solution I asked for was a little hacky. So I changed the question. :) ...

ControlTemplate.Resources in a code-behind file

How can I get a named resource from ControlTemplate in a code-behind file (*.xaml.cs)? TryFindResource returns null. Template property of the control is also null. What else should I try? Thanks. ...

how to give TAB-header color dynamically for WPF tab-Controls- Tabitem.?

hi, In WPF how to give TAB-header color dynamically- for WPF tab-Controls- Tabitem.? ThanX . ...

How to display a downloaded image in WPF window

I need to download a webcam image thru http, and refresh it at 10fps and display it on a WPF window. Right now I'm using this code: Window1 wndMain; BitmapImage img; DispatcherTimer tmrRefresh; public WCam(Window1 wndMain, string imguri) { this.wndMain = wndMain; this.MouseLeftButtonDown += delegate {...

Custom DependencyProperty issue

I did a test on custom dependency properties on WPF userControls, and does not work... Please help. Task: Having an UserControl - MyCircle, build the CenterX and CenterY bindable properties. Here is my code: MyTestCircle.xaml <Canvas x:Name="mainCanvas" Width="100" Height="100"> <Ellipse x:Name="myCircle" Fill="Red" ...

.NET Update WPF Control on own dedicated UI thread

Hi All I have a real-time application which constantly updates a UI log (RichTextBox control) in the form of a ListView control. The control is updated with current application data received via events. My application was running very slow and i found it was due to the ListView log being updated, which blocks the UI thread. As you can i...

UIElement.PreviewMouseMove or not MouseMove... that is the question

WPF, MSDN: UIElement.PreviewMouseMove Event Occurs when the mouse pointer moves while the mouse pointer is over this element. As I can see, this is not true... When I PreviewMouseDown, then PreviewMouseUp, an PreviewMouseMove event interferes. Is this a bug in Framework or MSDN documentation leak? I just need to differen...

Print documents via Wpf-controls and convert to XPS.

I'm trying to convert XAML control to XPS document, but i'd like to do this in batch mode - render control in memory and print it to XPS without rendering it on the screen. This project should work even without GUI. I've read Related topic on stackoverflow, but it's not working properly. I can create control, set DataContext, but output...

WPF/C# Forwarding events and DataProvider values within a UserControl

I have a UserControl which contains 4 ToggleButtons and I'd like to trigger a custom event that an interested object can listen for which provides a status, based on the ToggleButton Checked values and also value(s) from the DataContext object. Getting the ToggleButton checked values and deriving a status is simple enough, however I can...

ChangePropertyAction to modify Visibility not working in ListBoxItem DataTemplate.

I am trying to change the visibility of a control in a ListBoxItem template (based on it beeing selected in the parent listbox) through a ChangePropertyAction but the code below does not work. I tried fiddling around with setting the TargetName on the trigger or setting the default visibility of the control through a style. I debugged th...

WPF TreeView's Scrollbar is inconsistent

I have a WPF TreeView that has ScrollViewerVerticalScrollBarVisibility set to Auto. This treeview is in a Border, which is in a Grid. When I start my app, it populates the treeview and the length of the treeview is too long for the panel. So I'd expect a scrollbar. And as expected about 75% of the time I get one. But about 1/4 of th...

WPF TextBox repaints multiple times with mouse hover

Hi, I am using Windows Performance suite (which part of Microsoft Windows SDK) to profile my sample application. I am using the "Perforator" with an option "Show dirty-region update overlay", which enables me to see when and where areas are redrawn in an application. When I hover mouse over a TextBox control then I see that it is re...

Creating an instance of SelectionChangedEventArgs in wpf

Hi Experts, I have a user control which is having a listview inside it. The SelectionChanged event of this list view is handled inside the user control. The code for the same is as follows: private void lstvMyView_SelectionChanged(object sender, SelectionChangedEventArgs e) {...} I want to call this handler again fro...

WPF - binding integer list to combobox

Hi, I want to bind a List to a WPF combobox in xaml. Wondering what is the simplest way to do it. (The reason behind is I want to maintain the years as integer rather than doing the type conversion from string to int. I get a list of years(2009,2010,2011) from the DB and want to be able to bind this to the combo and get the selected ...