wpf-controls

How can I set the XAML for the first WPF RadioButton in a ListView control to be checked by default?

I have a WPF ListView control containing a number of RadioButton controls using data binding. I'd like the first RadioButton in the group to be checked by default, preferably set in the XAML rather than programmatically, but haven't managed to achieve this. My XAML for the control is: <ListView ItemsSource="{Binding OptionsSor...

WPF - TabItem Background color changes when tabitem selected or hover over

I set the Background color of the tabitem in the xaml to RED, but when i run it and hover over it or select it it changes back the the default greyish looking. It only shows correctly when the other tabitem is selected. How do i keep it RED all the time. Thanks! ...

Defining two different styles for ToolBar in WPF?

I want to make 2 different styles for the ToolBar control: One is based on black buttons and one on silver buttons. But I can't figure out how to apply my button styles to its own toolbar styles. The following only allows one style for the buttons: <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" BasedOn="{StaticResource Black...

Does WPF have a control for browsing the local file system?

I would like to add a control to my app where the user can browse his local file system and select a directory. I would prefer to host this control on my main app window, and not do this via a pop-up dialog. ...

How can I set my data binding in a WPF ItemsControl child to use a property on the parent data context?

I have a WPF ListView with a collection of RadioButtons. I want to set the GroupName of the child controls to be bound to a property on the parent data context. At the moment I am doing this by duplicating the property in each of the children's data context but that can't be right. My XAML: <ListView ItemsSource="{Binding OptionItem...

wpf: how to bind text box to custom virtual keyboard?

Hi I am designing a custom virtual keyboard based on stack panel and including bunch of buttons in it for multi touch purposes. The keyboard will be defined as a resource in order to be used on different windows,canvases etc. My question is that, how to bind the focused text box to this custom virtual keyboard? Best regards. Celil ...

How do I stretch the contents of a HeaderedContentControl?

I have a HeaderedContentControl that contains a TreeView. <HeaderedContentControl Header="Steps" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TreeView Name="WizardSteps" ItemsSource="{Binding WizardSteps}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <!-- Hierarchical data templates h...

c# wpf how to reference a dynamically added control

Just starting out with C#, so this may be overly simple that I keep overlooking it... In the main window I have a stackpanel, named targetDocArea, that will hold controls. Based on user input, controls appear in the panel like so: var htmlView = new System.Windows.Controls.WebBrowser(); htmlView.MinHeight = 200; htmlView.Height = deskHe...

adding rows dynamically based on the records in database in listbox mvvm mvvm light

Hi, I have a listbox in which I am displaying the records from the database. Its coming one after the other in a single column. How to put the records programitically as 3 rows and 3 columns i.e. 3 records in a row, after that 3 records in a row. Kindly suggest? Thanks. ...

WPF - TabItem Background color changes when tabitem selected or hover over

I set the Background color of the tabitem in the xaml to RED, but when i run it and hover over it or select it it changes back the the default greyish looking. It only shows correctly when the other tabitem is selected. How do i keep it RED all the time. Thanks! ...

Data binding to a UserControl in WPF

I have a UserControl that I want to participate in data binding. I've set up the dependency properties in the user control, but can't get it work. The uc displays the correct text when I call it with static text (e.g BlueText="ABC") . When i try to bind it to a local public property, it is always blank. <src:BlueTextBox BlueText="Feel...

WPF TextBlock requirement

I have a requirement for my textblock to have a character gap of 75 and a border line of 2 pixel. How would I achieve this? ...

Resize column header in listview wpf

How can set "AllowUserToResizeRows" property in Header listview wpf? it was in Windows.Forms thus :" dataGridView.AllowUserToResizeRows = false " My xaml code is : <ListView Margin="2.5,0,0,32" Name="listView1" ItemContainerStyle="{StaticResource myItemStyle}" SelectionMode="Single" HorizontalContentAlignment="Center" VerticalAlignmen...

Does memory leak if we set ItemSource property of a control to null in WPF?

I have a TabControl which is having 2 TabItems. Each of these two TabItems is having a listbox. On the SelectionChanged event handler I am setting ItemSource property of the appropriate ListBox to null and populating the other one with a Collection. Now when I keep on selecting each Tab there is a memory spike. What may be the possible r...

How to add context menu to wpf datagrid?

Just wondering how to add a DataGrid context menu to a DataGrid? I want to be able to right click anywhere on the DataGrid. Can someone please provide a simple hello world example (just popup messagebox or something)? Thanks! ...

WPF Binding and Using Custom Sample Data in Visual Designer

Quick 1 sentence summary: I wrote a demo app [download src here][1] that doesn't properly display sample data in the Visual Studio Designer and I need help. After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF (you can s...

How can I define a GridView for a WPF ListView so that the ListView items are distributed over more than one column?

I have a data-bound ListView in WPF with the ListView items being rendered as RadioButtons. I want to use a GridView to display these in a grid. I can find numerous examples for using a GridView where the data is to be displayed in columns (with different item properties in each column) but I want an entire child item in each cell not ...

LostFocus event problem and Button Command in wpf.

Hi, I have a textbox and inside its lost focus event, I show a new window and give the user choices, I also have a button below the text box. Now, when I change the value of the text box..and click the button (while the cursor is still inside the text box...) the lost focus event gets fired... but as I show a modal window dialog, the ...

determine a textbox's previous value in its lost focused event? WPF

Hi, I have a textbox and have an onlostfocus event on it. Inside the lostfocus method, is there a way I can determine if the user has actually changed the value in it? i.e how do i get hold of any previous value in it? Thanks ...

ItemContainerGenerator.ContainerFromItem returns always null

i have a TreeView that is bound to a collection, I want to expand a treeViewItem automatically from a object i used ItemContainerGenerator.ContainerFromItem, it returns always null the ItemContainerGenerator.Status is NotStrated i call StartAt method i have an exception "unable to call "StartAt" when the generation of content is bei...