wpf-controls

How do I tell WPF to treat my control's Padding as part of the control?

If I add some padding between the border of a control and the content, clicking/mousing over the padding doesn't work. When I mouseover the border, my trigger is activated. Then I reach the padding, and the mouseover deactivates. Then I reach the content and it reactivates. How can I make it so the padding is considered part of the c...

How can I use WebBrowser to display XML

I have some XML that I need to show. It would be perfect if I could use WebBrowser to display xml just like IE does. It has syntax highlighting and nodes can collapse. This works: WebBrowser browser = (WebBrowser)this.GetTemplateChild("PART_Browser"); browser.NavigateToString("<html>hello</html>"); However this doesn't: WebBrowser b...

area and perimeter of the circle

how to compute the area and perimeter of the circle using the distance formula. ...

WTF WPF TabControl?

I believe this to be a bug in WPF (v4.0 if it matters), but it is late, and maybe I'm missing something. I am binding to a fake example for illustrative purposes: <x:Array x:Key="SampleItems" Type="sys:String"> <sys:String>Foo</sys:String> <sys:String>Bar</sys:String> <sys:String>Baz</sys:String> </x:Arr...

When to use AttachedProperties in wpf

Here are my doubts, When to use AttachedProperties in wpf Should I use AttachedProperties only with ContentControls (like Panels) where are there one or more children What is the use of AttachedProperties Can I use AttachedProperties for extending properties of a control, i.e., properties that don't exists but I would like t...

UserControl Location in WPF

I am new in WPF, I created a new UserControl MyUserControl. Now I am surprised: the UserContol does not have a location. How can I read (by code) myUserControl1.Location in the parent container? I explain: I have some Dots (UserControls) that the user can drag in a panel. Actually, I am not sure what kind of Panel this will be... P...

Visualize/Edit Business Object's Properties in WPF

I am new in WPF and wondering about business properties visualization approach in WPF. I explain myself: I am a city architect and draw a city plan. My city is a canvas with rectangles, representing houses. I can drag rectangles on the canvas. Now, I need to edit house's properties when I select a house. Is there a WPF way to do it...

WPF Datagrid SelectionChanged event is triggering Multiple times while loading the rows.

Hi, When i use DataGridComboBoxColumn in my WPF DataGrid, the DataGrid SelectionChanged event is triggering multiple times based on the number of rows while loading the rows in the WPF DataGrid. How can i stop this? Because of this I am facing Performance issue. ...

Lock all controls except one without changing their appearance

Hi everyone! I need to Lock all controls of my window except one, if I write Me.MainGrid.IsEnabled = False I obtaind the result but many controls change the appearance. I need they maintain the current appearance, like when I open a WinDialog with ShowDialog. To redefine the style af all controls is a too much "chinese" work. There is ...

How to implement slider/progressbar for video app, YouTube style?

Hi all, I want to implement slider/progressbar like YouTube style. That means when mouse on the progressbar the tooltip show the time position exactly. How can I do that? Should I use Slider? or perhaps ProgressBar? Thanks in advance! ...

Radiobutton style based off of custom ToggleButton

I created a custom ToggleButton class, ToggleButtonEx, that extends ToggleButton. ToggleButtonEx contains some dependency properties that I created in order to use them in a template. I want to base the style of all of my radio buttons on the new toggle button style. Here is what I have: The ToggeButtonEx style, which defines the tem...

WPF - ComboBox Not Working Correctly.

Hi, I am developing a WPF appliction in .net 4.0 which has got one user control. For simplicity, this user control has got only one combox which gets its value from view model's observable collection. This observable colletion is populated via a call to EF entity which gets its data from a view. The combobox's itemssource property is bo...

All WPF control properties are dependency properties. True or False?

While answering this question I noticed that I have never come across any property which is not a dependency property (WPF Controls, no 3rd party controls). Although, when I started with WPF I remember reading somewhere that "more then 90% of properties of WPF controls are dependency properties". Can anyone give examples/links of CLR pr...

WPF numeric up down custom control

I've been needing to use a numeric up-down control for my WPF app. I read a similar question posted here and tried using the one available here > http://bot.codeplex.com/. I added the references and referenced it in my XAML window xmlns:lib="clr-namespace:PixelLab.Wpf;assembly=PixelLab.Wpf" and did this. <lib:NumericUpDown Name="yea...

Set CanContentScroll of default scrollviewer that a textbox have.

I want to set CanContentScroll to false of ScrollViewer that a Textbox have by default. I tried by setting normal - ScrollViewer.CanContentScroll to false. Dint Work. Override the default template of Textbox and set CanContentScroll of scrollviewer to false. Dint work. ...

wpf: How to add a Hyperlink at runtime?

Hi, I need to add several hyperlinks to the program's form dynamically at runtime (and handle user clicks on them). How to do this? I tried something like: var hlink = new Hyperlink(); myStackPanel.Children.Add(hlink); but hyperlink is not a UIElement... Thanks! ...

DependencyProperty and WPF Designer

class MyLine : Shape { public static readonly DependencyProperty X11Property; public static readonly DependencyProperty X22Property; public static readonly DependencyProperty Y11Property; public static readonly DependencyProperty Y22Property; static MyLine() { X11Property = DependencyProperty.Register("X11", ...

WPF Trigger not working (sample)...

I have a custom WPF Line, that I whant to change the Style when selecting with mouse. I tried to use triggers(see code bellow), but this does not work. Where is the problem? The IsSelected property is changed, but the StrokeThickness does not change at all... ( XAML: <UserControl.Resources> <Style TargetType="stops:MyLine" x:Key...

AvalonDock : Controling the Splitter position

Hi, Using AvalonDock and Odyssey OutLookBar in a WPF Desktop application. It doesn't make sense to have the vertical splitter in the ResizingPanel have full range of screen width. ResizeWidth as an attached property on the DockablePane does control the initial position. But then it can be moved from full left to right. Is there any way o...

WPF DataTemplate and Binding

I am DataTemplating a listbox's itemsource to display a label and combobox. In the, datatemplate I am assigning a new itemssource to the combobox but cant get it to work. Or Ideally, how can I bind the combobox in a datatemplate to a different source. Thanks. Mani UserControl: <DockPanel> <ListBox x:Name="lstBox" ItemsSource...