wpf-controls

How to reffer XML data to IValue Converter?

I am trying to build navigation model where pages are loaded into frame by selection listbox items of the ListBox and also by clicking 'back' / 'forward' buttons. Listboxitems with UriSource associated are generated from XML. While cliking 'back' / 'forward' buttons, I need to make the selected item in the ListBox be the current with the...

wpf image viewer path

I would like to make an image viewer where the client can load thumbnails to a file, then when the Photo Gallery button is selected the thumbnails appear in a grid and when the thumbnail is selected a larger photo will show in a viwbox. How do I get the path for the button click event to the photos? Can this be done in a markup ext? ...

Bind the datatable with ComboBox in WPF

Data is not Displaying in the Combo Box DataTable dt = new DataTable(); dt.Columns.Add("Code"); dt.Columns.Add("Name"); dt.Rows.Add("c1", "n1"); dt.Rows.Add("c2", "n2"); myCombo.ItemsSource = ((IListSource)dt).GetList(); myCombo.DisplayMemberPath = "Code"; myCombo.SelectedValuePath = "Name"; ...

WPF - Busy Indicator when switching between TabItems

What events do I need to handle on the tabcontrol or tabitem to show and hide a busy indicator when switching tabitems? (currently have a tabitem that has some lag when first clicked). Thanks! ...

Prevent resize of content in WPF

I have created a data template for a data class. The width of the grid created by the datatemplate is bound to a property in the data class, ie, the size of the control matters. I am creating a list of the data class objects, and adding them to an items control in MainWindow. Update: I would like to line up the controls from the data ...

How do prevent a WPF text box inside a combo from reacting to right mouse clicks?

I creating a custonmized box class (inherits from ComboBox). I don't want the text box to react to right mouse clicks. I can get rid of the context menu by setting this to null in ApplyTemplate, but right mouse clicks move the cursor. I tried hooking up PreviewMouseRightButtonDown in ApplyTemplate and setting Handled to True, but the eve...

Adding line WPF control on ToolBox

I need to draw lines and dots (circles) in WFP. (VS 2010) I tried using Ellipse control for dots, but I don't have the line ones. I however added <Line element directly in XAML and this worked... but how I have the line control in the toolbox? ...

dynamically adding control in async mode

I am using Wpf 4.0. i have a situation where i need to generate dynamic control on a tab control where around 20 tab are generated on run time. These controls are a lots so the control adding process take time around 1 minutes. is there any what to add control asynchronously. thanks ...

How to stop ComboBox SelectionChange from SelectionChanged Event

Hi, I have a ComboBox which is binded with a List. Consider I have 10 Items in the List, so in the combobox also. Currently 2nd Item is selected in the ComboBox. Now I am selecting the 3rd item in the ComboBox. In the Combobox SelectionChanged event, I am doing some validation and validation fails so I don want my Selection is change...

ItemsControl "Overflow to Popup"

Hi, I have an ItemsControl that I want to fit into a small space. Typically it will display less than 3 items, however, I would like the it to indicate when it has more items than it can display and have a popup on the indicator to show all items (which will still be aa small amount). The current ItemsContainerPanel is a WrapPanel, wh...

Windows application default UI

Hi, I've started the development of a windows application, which target windows 7 and vista (maybe XP). I wanted to have some standard behavior that we find in the default windows applications. But I can't find anything to do that, so I have some questions : 1) For example, on Windows 7, the address bar that displays the current folde...

How do I propertly set the tab oder on controls, on expanders?

I'm working in VS 2010. I've got a WPF page with 4 expander on it. On each expander I have between 10 to 20 controls. Normally I just let the default tab order work, left to right, top to bottom, so I don't mess with the tab order. However, on the first expander my users want the tab order to be very specific, so I'm going to have to...

Stopping WPF TextBox from growing with text

I am trying to modify my simple control so that the text box does not grow as the user types in long text. I took a look at some solutions posted here at Stackoverflow that suggest using a Grid and an invisible Border and binding the Width of the text box to the ActualWidth of the Border, but I can't seem to get it to work in my setup. ...

Why can a control draw outside its bounding box?

Here's an example image of what I mean: example The gray rectangle is the bounding box of a control that draws the blue lines and dots in it's OnRender(...) method. The red ovals mark places where it happens. Why is that possible? How can it be avoided? ...

Row Number In datagrid Control WPF

How can I display row number in the first cell of the datagrid control, I don't have the row number or any other information, just data from the data base and Some Value Some Other value and I want the output like First Some Value Secont Some Other Value How can I do that, any idea ...

How to write generic ListView ControlTemplates?

Generally speaking, ListViews are used like this: <ListView> <ListView.View> <GridView/> </ListView.View> </ListView> And pretty much every template i have encountered so far assumes that View property will be a GridView. The ListViewItem templates i have encountered always look something like this: <Border> ...

Toggle button as Radio button style

I wanted to group a number of toggle buttons and have them behave as radio buttons. So what I did was add radio buttons to my xaml and created the following style: <Style BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="RadioButton"> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="FontSize" Value="12"/> ...

What is wrong with this TextBox style ???

Why doesn't this simple Style work for a TextBox? I expect the background/foreground colors to change when I change the text between "0" and "1" ... <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}"> <Setter Property="Background" Value="Gray"/> <Style.Triggers> <!-- If the T...

Trigger repaint of WPF Button control from external thread

Hi there. I am having some issues with WPF not fully repainting a button control when the button is changed from another thread, and I am not sure how to force it to do a full repaint. The situation is that on receipt of a message (via WCF - but the source isn't important, except that it is an external thread) I update the foreground ...

Setting control height explicitly

I have a XamDataGrid in one of my user controls, inside of a stackpanel. I want the grid to maintain the same height regardless of how many rows are present in the grid. To do that, I set the grid's Height property to an explicit value. Is that how things are done in WPF? Every time I do explicit sizing I feel like I am doing WinForm...