wpf

WPF: Can't get to original source from ExecutedRoutedEventArgs

I have a problem getting to the original source of a command using ExecutedRoutedEventArgs. I'm creating a simple splitbutton, in which a menu will appear below a dedicated button, as another button is pressed. When I click a menuitem in the appearing menu a command is fired. This command is registered on the splitbutton. And the idea i...

Difference between Control Template and Data Template in wpf

hello, Can someone elaborate the difference between Control template and Data template in wpf? What should one use in case of custom controls? Like for example a stackpanel which possibly has an image and a textbox? It seems confusing in some cases where you define a custom control using the 'Content' property. It would be great if an...

Button template with image and text in wpf

Hello, I want to create buttons with images and text inside. For example, i would use different images and text for buttons like 'Browse folders' and 'Import'. One of the options would be to use a template. I had a look at simliar question http://stackoverflow.com/questions/1933127/creating-an-imagetext-button-with-a-control-template ...

WPF: How to make Contextmenu select and forget?

I have a Contextmenu with a ListBox inside. Whenever I right click my control and select a value from my contextmenu the last selected value stays marked and I can't select that value again. The idea is, that I may select the same value within the COntextmenu in order to turn a property on or off. Should be quite basic, what am I miss...

WPF Combobox loaded with list collection view fails to update selection on change (MVVM).

Hi Guys, Ok here is the deal (a bit wordy but I hope you will get the idea) I use MVVM for binding properties of a combo. The combobox is bound to a ListCollectionView with source collection of employee objects which is sorted by the emp. name . There is binding on SelectedValue of the combobox by the employee id. DisplayMember is em...

WPF and events from dynamically created controls

Hi, I need some help to implement a common behavior in some controls. In my WPF application, I have a main form that contains a panel and a button: Ok The button will run a Save method when clicked.The Save method reads some data from the form and saves the data to...

WPF dependency property setter not firing when PropertyChanged is fired, but source value is not changed

I have an int dependency property on my custom Textbox, which holds a backing value. It is bound to an int? property on the DataContext. If I raise the PropertyChanged event in my DataContext, and the source property's value is not changed (stays null), then the dependency property's setter is not fired. This is a problem, because I w...

Issue binding Image Source dependency property

Hello, I have created a custom control for ImageButton as <Style TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Local:ImageButton}"> <StackPanel Height="Auto" Orientation="Horizontal"> <Image Margin="0,0,3,0" So...

How to achieve rotating form effect in wpf.

Hi, I would like to make a rotating form WPF effect like the one in the norton antivirus 2010. The effect is a rotating form that changes the contents when the other side is shown. But the axis is not in the center of the form but moves from side to center and back. Like a three step effect. The rotating form can be seen at 8' 07" in t...

Weird typewriter sound as I type into a textbox (wpf) in C#.

I've made a pretty simple WPF windows with a textbox in it. As I type in it it gives me this weird typewriter-sound. Any idea why? And how can I stop it from doing it? ...

Where has MS Charting gone in .NET 4.0?

Forgive me for being a little naive perhaps, but it seems that System.Windows.Controls.DataVisualization.Charting has vanished from VS2010, and blend 4. I'm trying to make a bar graph with a line overlayed, but can't even get started because I can't find the appropriate controls. I know I could use an external graphing package, but I'd...

Can we manipulate (subtract) the value of a property while template bidning?

Hi, I am currently defining few grids as following: <Grid.RowDefinitions> <RowDefinition Height="{TemplateBinding Height-Height/5}"/> <RowDefinition Height="{TemplateBinding Height/15}"/> <RowDefinition Height="{TemplateBinding Height/20}"/> <RowDefinition Height="{TemplateBinding Height/6}"/> </Grid.RowDefinitions> While ...

[WPF] The calling thread cannot access this object because a different thread owns it.

Why I can't create CroppedBitmap in the following code ? I got an exception : The calling thread cannot access this object because a different thread owns it. If I change the code to CroppedBitmap cb = new CroppedBitmap(new WriteableBitmap(bf), new Int32Rect(1, 1, 5, 5)); the exception is gone? why ? Code 1: exception at cb.Freeze()...

WPF Docking Control Recommendation

Is there a Docking control that does a good job and provide good options for ReSizing? I want some docked windows to be of fixed width/Height and others to resize. Most of the Docking controls I have tried, doesn't provide good option to set minimum/maximum width or even specify starting width. To put my question other way, if I create...

wpf keep base style in custom control

Hello, I have created a custom button as i wanted an image and a text inside it as follows: <Style TargetType="{x:Type Local:ImageButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Local:ImageButton}"> <StackPanel Height="Auto" Orientation="Horizontal"...

WPF: Bind width on UI element to Width of another UI Element

Hi, I wanted to bind Width of column header to the Width of the header defined. However the code doesn't work. If I specify the Width explicitly (Width="100"), it works fine. Can someone shed some light and tell me what is wrong with the code below? <dataGrid:DataGridTemplateColumn x:Name="pdpCol" Width="100"> <dataGrid:DataGri...

[WPF]: Styling a scrollbar, but the ListView scrollbar is not affected by the style

I am styling a scrollbar in a resourceDictionary without giving it a key value: <Style TargetType="{x:Type ScrollBar}"> ... </Style> Bur for some reason only a component of the type Scrollbar are affected by the style. Not the ListView component's scrollbar! I would Think that all scrollbars would have the same style since I am...

Dependency Property Set Priority: CodeBehind vs. XAML

When I initialize a control property from code, the binding to the same property defined on XAML don't work. Why? For Example, I set control properties on startup with this statements: myControl.SetValue(UIElement.VisibilityProperty, DefaultProp.Visibility); myControl.SetValue(UIElement.IsEnabledProperty, DefaultProp.IsEnabled); and ...

RDLC: How to print multiple tables in one report

I'm generating the RDLC XML schema and showing the report in the ReportViewer control. No problems there. Now, I want a report with 2 tables, with 2 differents dataset. Something like this gets generated: <Body> <ReportItems> <Table Name="Table1"> .... </Table> <Table Name="Table2"> ...

WPF and Application.ThreadException

Possible Duplicate: WPF global exception handler Hello SO, since "good old" WinForms days, I have been writing client code similar to static void Main (string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; System.Windows.Forms.Application.ThreadException += ...