wpf-controls

Is there a way to pass a parameter to a command through a keybinding done in code?

I am making a custom control I need to add some default keybindings, microsoft has already done with copy and paste in a textbox. However one of the keybindings needs to pass a parameter to the command which it is bound to. It is simple to do this in xaml, is there any way to do this in code? this.InputBindings.Add(new KeyBinding(Change...

Add an extra row in a ListBox with XAML.

I have a ListBox with radiobutton on the horizontal line. Number of radiobuttons is optional. The text for each radiobutton is taken from a list of the model. Which radiobutton that is selected will be determined by the property SelectedOption. If none is select it shall be set to -1. The problem is that I wish that in addition to the ch...

Windows 7 "Devices and Printers" like interface

Hi, I want to make a window interface just like "Devices and Printers" window in Windows 7 in which items can be suppressed and drilled down. Any ideas how can i build such a view and which controls from wpf can be used. Any ideas are greatly appreciated ! ...

WPF Layout algorithm woes - control will resize, but not below some arbitrary value.

I'm working on an application for a client, and one of the requirements is the ability to make appointments, and display the current week's appointments in a visual format, much like in Google Calendar's or Microsoft Office. I found a great (3 part) article on codeproject, in which he builds a "RangePanel", and composes one for each "pe...

ScaleTransform and Image size

I have a Canvas which has an image as background. When I do the ScaleTransform to increase the size of the image, the image blows out of the Canvas. Although I increase the size, I don't want the image to go out of the Canvas, I just want it to fit inside the Canvas. How to fix this issue in WPF? ...

Drawing a text in OnRender method

I have a class which inherits from Canvas. On the OnRender method I draw a text which is being covered by the controls that are on the canvas. Is there a method to place the text "above" the controls? is there an OnRenderComplete method (that is being called after the visual tree was rendered)? ...

How do I bind one TabControl to the TabItems of another TabControl in WPF?

I've defined the following TabControl called TabControl1: <TabControl> <TabItem Header="Cheese"> The Cheese Tab </TabItem> <TabItem Header="Pepperoni"> The Pepperoni Tab </TabItem> <TabItem Header="Mushrooms"> The Mushrooms Tab </TabItem> </TabControl> I've defined another TabControl, TabControl2 which is dynam...

Exposing inner controls Content property as own [User Control]

Hello, I'm new to WFP and try to learn it via different examples. Right now I want to create a custom user control, which have button inside it (among other controls). I want to expose Buttons Content property as User Controls own. User Control: <DockPanel LastChildFill="True"> <Button Name="ClickButton" DockPanel.Dock="Right" Foc...

Using a Control Template for all controls across the application

Hi, I have a control template in one of my pages and i am assigning this template to my textbox's Validation.ErrorTemplate property. The following code would give you a better view. <ControlTemplate x:Key="ValidationErrorTemplate"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <AdornedEle...

Unable to select item in combobox with binding implemented

Hi Experts, I have implemented a binding on a selected item of a combobox as ComboBox1.ItemsSource = Masters; Binding binding = new Binding("RecordID"); binding.Source = Masters; binding.UpdateSourceTrigger = UpdateSourceTrigger.LostFocus; binding.ValidatesOnDataErrors = true; binding.Mode = BindingMode.TwoWay; ComboBox1.SetBinding(C...

reading text from multiple WPF textbox controls from a different thread

In my WPF application I need to read text from several textboxes. Because the code is running in a different thread to the UI, I need to use Dispatcher.invoke. At the moment I’m working with one textbox which works fine, but now I need all the texts, do I need to write a Dispatcher.invoke for each textbox or is there a way to write a fun...

WPF - How do I use the UserControl with a dependency property and view model?

Hello, My goal is to have a user select a year and a month. Translate the selection into a date and have the user control send the date back to my view model. That part works for me....However, I cannot get the ViewModel's initial date to set those drop downs. public static readonly DependencyProperty Date = DependencyPropert...

Binding ListBox to List (Collection) in XAML

Hello, I'm learning WPF, so I'm kind of n00b in this. I saw some examples about how to do what I want to do, but nothing exactly... The question: I want to bind List to ListBox. I want to do it in XAML, w/o coding in code behind. How can I achieve that? Right now I do it that way: <!-- XAML --> <ListBox x:Name="FileList"> <ListB...

How to change the style of a combobox to a label or hyperlink in WPF?

I want to change the style of a combo box control to look like a hyperlink. When user clicks on the hyperlink ( combo box) it show options in the combobox to select. The idea is that I want combo box control to display as a plain text ( more readable form). If anybody created this type of sytle please let me know. ...

Binding a slider value on the height of its thumb in WPF

Hi, I have a databinding problem in WPF. I would like to "customise" a slider in a way that the thumb grows when you move the slider to the right and the thumb shrinks when you move the slider to the left. So I edited the template for the slider and changed the look of the slider so the slider looks like I want it to. But now I have ...

difference between datagrid and grid in wpf

hello, Can anyone tell me the difference between DataGrid(not GridView) and Grid controls in wpf? Thanks ...

WPF Visual Studio Designer and Expression Blend are not respecting TypeConverter on DependencyProperty

I have added the dependency property MyList to a wpf textbox. The dependency property is of type List<string>. In order to make things easier in xaml I have defined a converter so that I can have following syntax: <Grid> <controls:MyTextBox x:Name="Hello" MyList="One,Two" Text="Hello" /> </Grid> In Visual Studio I can't edit the...

Wpf: Loading DataGrid in Groupbox causes Groupbox to be too tall

I have a GroupBox that contains a stackpanel holding a textbox and a datagrid. When I use the textbox to populate the datagrid. Sometimes I need to load the datagrid with values. What I am noticing is that when the groupbox renders when the datagrid has values that the height of the groupbox is maxed out to the size of its parent contain...

Checking if a RoutedEvent has any handlers

I've got a custom Button class, that always performs the same action when it gets clicked (opening a specific window). I'm adding a Click event that can be assigned in the button's XAML, like a regular button. When it gets clicked, I want to execute the Click event handler if one has been assigned, otherwise I want to execute the defaul...

Grid related UI design question

Grid related UI design question I want some 16-grid (4 rows and 4 columns) user interface, and fill the grid with some round shapes. I also want to use the MouseOver, mouse left button down, and Mouse Left Button Up events to set the state of grids as selected or not selected. My questions: 1. How fill the grid with some round shapes?...