wpf-controls

SetBinding for Listbox in WPF

Hi, How to set DisplayMemberPathProperty and SelectedValuepathProperty for Listbox in codeBehind? Listbox1.SetBinding(ListBox.ItemsSourceProperty, new Binding { Source = _ItemCollection}); The above line of code works fine and i can see the data in listbox. But when i try to set the displaymemberpathprop and selectedvaluememberpathpro...

Reorder tabs in WPF TabControl

Is there an easy way to customize the WPF TabControl so that it supports TabItem drag and drop - similar to what IE and firefox do. ...

Listen to child MenuItem Click

Is there a way for a parent MenuItem to be notified when a child MenuItem is pressed. For example, I you have <MenuItem Name='a'> <MenuItem Name='b' Header='...'/> </MenuItem> how can I add an event handler to a to be notified when b is clicked. Ideally, the Click event would be either a tunnel or bubble event but this is not the ...

WPF: Inheriting from HeaderedContentControl

I would like to create a simple control that inherits from HeaderedContentControl, and has some basic dependency properties called Title, Subtitle, Icon. I would like to be able to provide a default header template that databinds these properties. For this example, I have named this class HeaderedView. I am having trouble in providing a...

WPF TextBox. How to define some restriction?

How can I restrict TextBox to accept only capital letters, or for example digits, or forbid to put any special character? Sure it's a piece of cake to catch TextInput event and handle the text here, but is it the proper way to do this? ...

Visible line count of a TextBlock

If you set TextWrapping to "Wrap", a WPF TextBlock can have several lines of text. Is there a "clean" to get this number of lines of text? I considered looking at the desired height and dividing it by an estimated height of each line. However, that seems quite dirty. Is there a better way? ...

WPF DataGrid how to get when ItemsSource updates

Which event fires when DataGrid's source is updating? I've tried DataContextChanged and SourceUpdated but it never worked out. Actually I need a simple thing. I want, if there is a new row comes, scroll the GridView's scrollbar down to the bottom to see what it was. ...

ComboBox Selected Item in WPF

Hi, How to set the combobox selected item in xaml? I tried something doing like this <ComboBox x:Name="cmbProject" ItemsSource="{Binding Project}" DisplayMemberPath="Name" SelectedValuePath="Id" SelectedItem="{Binding Path=Project,Mode=TwoWay}" SelectedValue="{Binding Path=Id,Mode=OneWay}"/> The above code does ...

want to get a UIElement's Size

hi, I want to get a UIElement's Size, but when I use the DesiredSize or RenderSize property, it always return {0,0}. Could anyone help me? Thank you! ...

Announcments Control in WPF

What is the recommended way to implement an announcments (or news) control in WPF? Thanks. ...

WPF Control actual size

Hello, I have this piece of XAML code: <Window x:Class="SizingTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <Label x:Name="theLabel" Width="Auto">A very large label with a lot of ...

Placing common contols in two tab pages.

I have a tab item with 2 tab pages. I want to place 4 check boxes in each of the tab pages with all check boxes having the same property. How it can be done easily? ...

WPF - CanExecute dosn't fire when raising Commands from a UserControl

Hi, I've got a button strip usercontrol that I want to have on most of my forms. I've added the commands as follows ... public ICommand Create { get { return buttonCreate.Command; } set { buttonCreate.Command = value; } } I've set these as dependency...

WPF RichTextBox Custom Text Property

Ok, I'm trying to add a "custom property" to a piece of text in a RichTextBox control. I thought it would be easy, but apparently not :-) The basic functionality I want is to be able to set a property on a particular word and be able to detect, when a word is double clicked, if that property is there or not. My intial approach was to c...

WPF TreeView with custom style

Could you help me? I need a TreeView with a CheckBox at every item. I can't get it, I started like this, and seems like absolutely wrong way: <TreeView Grid.Row="0" Grid.Column="0" Name="StagesTreeView" Margin="5"> <TreeView.Resources> <Style TargetType="{x:Type TreeViewItem}"> <!-- <Setter Propert...

How can I change the FontFamily in a WPF RichTextBox without modifying previous text

When you use the FontFamily property of the RichTextBox it changes the FontFamily of the whole content inside the FlowDocument. The same way you can Execute a command like EditingCommands.ToggleBold, where it only changes the word under the caret or just the new text to be written, there should be a way to do the same thing with the Fon...

WPF Control in small container size

Hello, I have this problem. I need to know the size a Label is trying to use, but since the control that contains it is smaller than the actual label, when I call label.ActualWidth, what I really get is the width of said container control. Is there a way to get the width that the label would require to fit its content (disregarding its A...

Issues with CustomContainer for RadioButtons in WPF

Hi I want to create a custom control which would only contain RadioButtons. I imagine it being used as follows: <RadioButtonHolder Orientation="Horizontal"> <RadioButton>RadioButton 1</RadioButton> <RadioButton>RadioButton 2</RadioButton> <RadioButton>RadioButton 3</RadioButton> <RadioButton> ...</RadioButton> </RadioButtonHolder> C...

WPF UI control vendors - ActiPro, Telerik, Xceed, Infragistics, DevExpress and others

Dear ladies and sirs. I have to choose a commercial WPF UI control library for our project. Browsing the web I have found these major vendors: Actipro: http://www.actiprosoftware.com/Products/DotNet/WPF/WPFStudio/Default.aspx Telerik: http://www.telerik.com/products/wpf.aspx Xceed: http://xceed.com/pages/TopMenu/Products/ProductSear...

How can I assing the Caret to a Control in WPF

Need to make a new WPF control and give the Caret to it. In WINFORMS or previos Windows UI it was easy using the WIN API Caret functions, but now in WPF we don't have hwnd for each control so... is there a way to do it? ...