wpf

When are event subscriptions with strong references actually desired/required?

I'll start with a description of the problem regarding events and strong references. Copied from here It is often the case that the "subject" (the object with the event) has a longer lifetime than the "observer" (the object that subscribes to the event). When we are no longer using the observer, we would like it to be garbage collect...

Change view when selected ribbon tab item changes

I'm using Fluent ribbon in a MVVM application. For each tab item I associate a view and a view model (set a new DataContext). How can I change the view and the view model (DataContext) each time when the selected tab item is changed ? It would have been nice to have an event that fires each time a tab item is selected, like Microsoft Rib...

Setting AutoReverse true/false after Animation Starts.

After Animation Starts in AnimationClock how we will control AutoReverse True/False in Int32Animation. code Snippet. Int32Animation FrameAnimation; public void Load(){ FrameAnimation = new Int32Animation(); FrameAnimation.From = 1; FrameAnimation.To = 100; AnimationClock FrameAnimationClock = FrameAnimation.CreateClock(); A...

Update content binding when subproperty changes

Hi all, I have a label like this: <Label Name="LblUsersWithHair"> <Binding Path="Users" ElementName="ElementSelf" Converter="{StaticResource Converter_UsersWithHairPresenter}" /> </Label> And the converter: ... public object Convert(object value, Type targetType, object parameter, System.Globalizatio...

How does WPF build up the list of controls that can be tab-navigated?

I am curious to know how WPF figures out where the focus should be set when the user hits the TAB key. Thinking aloud, I feel: It may be doing relative search on the UI and find the nearest control based on (x,y) location. It could manually walk the logical sub-tree to look for the nearest control Does it do it each time the TAB key ...

simple binding problem

I have a rather simple problem, but I am unable to get my head around it... I have a class that inherits from UserControl. It has an AxisColor DependencyProperty of type Color. In the XAML structure of the class I have <ms3DTools:ScreenSpaceLines3D Thickness="2" Points="0,0,0 100,0,0" Color="{Binding Mode=OneWay, Path=AxisColor}". The b...

WPF Resolution Handling

Hey. I've got a list of 3 resolutions I need to target with a WPF application. However, I've never used WPF before and was wondering what the best way of targetting these would be. 1024x600, 1600,768 and 1024x576 are the main resolutions. The application does not run full screen, so should I simply target the lowest one (1024 x 576) ...

Preview can execute command called, but menu item not disabled

I'm rehosting the MS WF 4 designer control in my application. I'm subscribing to the PreviewCanExecute handler for a given command. My event handler method is called. However, when I set the CanExecuteRoutedEventArgs.CanExecute property to false and CanExecuteRoutedEventArgs.Handled property to true, the context menu still appears ena...

Usercontrol in a Listview.

I thought a simple problem like this should be no-brainer but after hours of searching I'm still not able to fix this one. I'm probably not thinking the WPF way because it looks I'm the only one on internet with this problem :) Here's the problem. I'm having a fairly simple listview with a datatemplate (leaving some none-relevant code o...

Sort of LineSeries WPF Charting Control

hi, i am plotting a LineSeries in the WPF Charting Control. by default the dataPoints in the LineSeries are sorted based on x-Axis value. how can i disable or change to it to some custom value? Thanks Naresh ...

TDD type methodology for WPF / Silverlight

Has anyone got a TDD-ish methodology for designing complex WPF xaml components (i.e., ControlTemplates, Custom Controls with dependency properties)? Is eyeballing the UI the closest you can come to asserting your code is correct? How about incremental development; any aids to dividing up the logic incrementally? If there isn't any meth...

WPF - how to synchronize CollectionView's CurrentPosition with ListBox?

Summary of my question: I am canceling from CollectionView's CurrentChanging event and ListBox still allows highlighting other items (even though the current position doesn't get changed. How can I prevent ListBox from highlighting other items? More details: I have a ListBox showing entities, synchronized with controls to edit it. IsSy...

WPF: Transparent menus on windows XP

I've been developing a WPF application using Windows Vista/7. During the testing phase I tried it on Windows XP (SP3) and noticed that all of the menus in the application, including the system context menus in textboxes appear to be transparent: I don't think I did anything to "deserve" this kind of behavior - all of the menus in XAML...

WPF, property bound to dependent ComboBox always gives initial value

I have a ComboBox that needs to depend on the value of another ComboBox. This part already works, with the dependent ComboBox refreshing when a new value is chosen in the independent ComboBox: <!-- Independent --> <ComboBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" x:Name="cbo_product" VerticalAlignm...

Multiple Bindings to DataGrid Column

Is it possible to bind two different data to the same DataGrid column. Say if I have class A which has the Property p1 and I have another class B with the Property p2. Is it possible to bind p1 and p2 to the same datagrid column? ...

WPF:How to Tell my DataLayer which DataContext to use ?

I have a solution where i have 3 WPF projects under it(Project UI-A, Project UI-B and Project named CommonLibrary(Data Layer).I have a user registration form in the Project UI-A where i will capture the User profile information.And in the CommonLibrary project i have a class called "UserCommon" which will have a method to save the data t...

How can I accept pastes from the clipboard in my UserControl?

I've got a UserControl that, oddly enough, bundles a bunch of other controls and logic into a tidy little package. It has a Text property that accepts a string and does magic, displaying the results for the user. Awesome. I get that text from a TextBox. The user pastes text from the clipboard in the textbox, which is bound to a DP on...

Change the content of a ComboBox in a DataGrid based on a value in the ItemsSource (WPF)

I have a datagrid in which one column would be title. I want the title to be able to be editted and the edit to be a comboBox that contains a list of titles based on the sex of the person the row represents. So say one would have "Mr" in the drop down for men and then the other would have "Ms.", "Mrs." and "Miss" for women. So I can't...

WPF UserControl not rendering at design time

I am relatively new to WPF, so I apologize if I am missing something basic. I have a user control where I declare dependency properties named PT1x, PT1y, PT2x, PT2y: Private _pt1x as double = 9 Public Property PT1x As Double Get Return GetValue(PT1xProperty) End Get Private Set(ByVal value As ...

Specifying a WPF's databound attribute's design-time value in XAML

I'm playing around with a Canvas inside of a Viewbox, and unforunately, the only way to see the elements in the Canvas, I have to assign it a Height and Width. However, the problem is that my Height and Width values come from my ViewModel via databinding. I know that Blend gets around this with the d: designer namespace, which is set t...