wpf

TextBox custom ContextMenu in Style, multithreading error

In WPF application I use Textbox with custom style in which ContextMenu is overriden like this: <Style TargetType="{x:Type TextBox}"> <Setter Property="ContextMenu"> <ContextMenu> <MenuItem Header="Copy"/> </ContextMenu> </Setter> </Style> This works perfectly until I'll run window with TextBox in diffe...

Good Book for Learning WPF using C# in Beginner's point of view

Hi all, I want to learn “WPF using C#” properly. I read basic concept of WPF using C# language. Since I know C++ and HTML It did not took too much time to read C# and XAML simple tutorial. Now when I searched for the WPF tutorial, most of the sites give WPF features and some of the .net controls API and class usage. But I want a boo...

IsEnabled for a container?

Is there any way to disable all controls inside a container - grid for example? Thank you! UPD: Although WPF’s Grid has IsEnabled property, there is definitely no IsEnabled property for Windows phone 7 Grid. ...

C#, Linq data from EF troubles

Hello, I don't have much experience with programming. I am working (to learn) on a project. I am using C# 4.0 and WPF 4 with EF (SQLite). I am having problemw with LINQ. Here is the code in question (I hope this is enough, let me know if more is needed) private void cboSelectCompany_SelectionChanged(object sender, Selection...

Changing VisualState of a control by binding it with some property of ViewModel.

Considering the code below: xmlns:interactivity="clr-namespace:Microsoft.Expression.Interactivity;assembly=Microsoft.Expression.Interactivity" ... <ToggleButton IsChecked="{Binding Path=IsGlobalControllerAttached}" Command="{Binding Path=AttachDetachGlobalControllerAction}" ToolTip="{Binding Path=GlobalControllerToolTip}" Visibility...

Creating WPF ResourceDictionary from code doesn't seem to work when setting ResourceDictionary.Source

I have a project containing a xaml ResourceDictionary that I wish to use outside of a FrameworkElement. The resource dictionary will contain a DataTemplate for a class local to the project to avoid polluting the app.xaml (as the project is a prism module, and will not always be present depending on config). So, I have a test.xaml file w...

WPF - WIth animation change from LinearGradientBrush to SolidColorBrush

Is it possible with an animation to change the Ellipse.Fill from a LinearGradientBrush to a SolidColorBrush or change the gradientStops within the LinearGradientBrush? ...

WPF: Creating KeyBinding with more than 1 modifier keys

The way I created KeyBinding is something like <KeyBinding Modifiers="Ctrl" Key="S" Command="{Binding SaveCommand}" /> but what if I needed 2 modifier keys? eg. Ctrl+Shift ...

WPF - Animation on SelectionChanged

How would I go about changing a TabItem color from it's unselected color to it's selected color with an animation on SelectionChanged, so that both the unselected and selected TabItems change? Edit: This is how my CustomTemplate looks like. There is no animation happening at all so what have I done wrong? <Style TargetType="TabItem"> ...

Command Binding not working when the host control is added programatically in wpf

This is weird. I have a UserControl (MyControl) with a button inside. I have added a command to this button whose command target is another user control which is again added to the same window. When I add the UserControl statically in xaml to the CustomControl's host space, the CommandBinding system works fine, where as the same doesn't...

Can I have multiple instances of the same UserControl in 1 app?

I am creating a Text Editor Type app. I can have multiple editors open via tabs. In my first try, I used simple TextBoxes to edit text. Everything worked ok. Then I created a UserControl encapsulating the text box + buttons to perform text manipulation eg. bold/italic etc. I found out that when I open different tabs, they all contain the...

How to access the element within the DataTemplate of GridViewColumnHeader?

Hello!! How can I get access to an element (TextBlock) within the DataTemplate of GridViewColumnHeader from the code???? I want to set focus on the column header. ...

Custom Control Threading in WPF.

Hello EveryOne I am using WPF and I made some customecontrol just like a treeview, but this is the listtreeview so I am loading my all data into this treeview so it will take a much of time. so I am worry about how to implement threading to improve the perfomance... its urgent if u guys tell me. Thanks.. ...

What is the Disadvantage of VirtualizingStackPanel?

What is/are the main disadvantage of VirtualizingStackPanel? If it doesn't have any, then why it is not made as a default panel behavior/template in ItemsControl? ...

Binding Menu ItemsSource to a recursive data structure

I have a simple data structure (the properties are of course Dependency Properties): class MenuData{ public string Header {get; protected set;} public ObservableCollection<MenuData> Items { get; protected set; } } ObservableCollection<MenuData> Menus {get; protected set;} I want to bind the Menus property as Menu element Item...

In WPF how to get binding of a specific item from the code?

The example of this would be: A textBox is bound to some data. There is a second text box which is not bind to anything. So I want to bind text box 2 to the same data 1st textBox is bound. In other words I wan't to know if the DependencyObject stores some reference to it's data-bindings? If not, what is the way to find out all data-bin...

How to create a custom WPF Window like this one?

...

How to implement mdi in a wpf application

I'm mew to WPF and I really like MDI applications. It allows me to move quickly between windows and compare the content of different windows. Furthermore, sometime the content of one window is useful for another so I can copy and paste. I think it's a great user experience for working mode. Right or wrong practice, I love it. I saw ht...

What are the tools available for troubleshooting WPF and Silverlight Databinding issues?

In general, what are the best practices to debug a Silverlight or WPF application, especially when you get errors with Databinding? Are there free tools available? I am not getting any errors as such, but I am interested in figuring out the approaches that you take as Silverlight and WPF experts. Thanks! ...

Is there a way to visualize an ItemTemplate in WPF

I have an ItemsControl that has a fairly complex ItemTemplate which allows the user to edit an Order. Unfortunately the design surface in Visual Studio does not show the ItemTemplate so I don't get an instant feedback of the changes I make. Is there a way to visualize the ItemTemplate in Visual Studio? Here's the structure of my control:...