dependency-properties

WPF RichTextbox remove Foreground information from TextRange

Hey, sorry for my bad english... The default for a RichTextBox content is to inherit the Foreground color from the richtextbox itself. Thats nice, but if i set an especific color to some part of my text, that part do not inherit the foreground anymore, obviously. Now how can I make a part of that "colored" text inherit the parent color a...

C#: Extending from more than 1 class

Suppose I have a ViewModel TabViewModel that Extends ObservableObject the class for ViewModels in the MVVM Foundation Framework. Then I also have a EditorTabViewModel that extends TabViewModel, Now I need to extend DependencyObject to implement DependencyProperties. I cannot extend more than 1 class. How might I implement this? I could h...

Am I using DependencyProperties wrongly?

I have declared my dependency properties as follows public bool CanSave { get { return (bool)GetValue(CanSaveProperty); } set { SetValue(CanSaveProperty, value); } } public static readonly DependencyProperty CanSaveProperty = DependencyProperty.Register("CanSave", typeof(bool), typeof(EditorTabViewModel), new PropertyMetad...

WP7 Dependency Property Binding Problems

I have a user control containing a listbox. I want to bind to the listboxes selected item property so I created a dependency property. public HousePrice SelectedItem { get { return (HousePrice)GetValue(SelectedItemProperty); } set { SetValue(SelectedItemP...

Silverlight Depedency Property Not Updating/Changing

I am having trouble updating a dependency property in Silverlight. I am setting a property and notifying it changed in my parent class. The custom control listens to this property changing through a dependency property, but it never hits it (calls the change callback). I have been playing around with it and the only time I can get it ...

Bind IsClosed property of context menu

I have project which implements MVVM pattern. I have WPF window which has reusable usercontrol in his xaml. UserControl consist of WPFDataGrid. Also DataGrid has ContextMenu. I want do some staff when context menu is closed. But ContextMenu class have not dependency property which give me ability to know is it close or not. I cannot farw...

WPF: Getting of controls collection with setted Dependency Property

I have dependency property in my UserControl "Menu": internal static readonly DependencyProperty ActionProperty = DependencyProperty.RegisterAttached( "Action", typeof(LetterAction), typeof(Menu), new FrameworkPropertyMetadata(LetterAction.None, ActionChanged)); I set this property into control: <my:Ribbo...

Default Value for Dependency Property in Silverlight Custom Control

I've set up a custom control in SL and I'm trying to get the default look of the control to behave properly. I feel (with the help of some smart folks on here) that I am getting pretty close to getting this, but I'm still not quite there yet. When my control is first added to a panel in Blend, it shows up as I expect based on the templa...

Change non static object from static Context

I have next dependecy property: public static DependencyProperty IsInReadModeProperty = DependencyProperty.Register("IsInReadMode", typeof(bool), typeof(RegCardSearchForm), new PropertyMetadata(false, ReadModeChanged)); and I have next method which handle Property changed event: public static void ReadModeChanged(DependencyOb...

XML Documentation for dependency properties

What is the best way to document a dependency property? Should I put the xml documentation on the field: /// <summary>Documentation goes here</summary> public static readonly DependencyProperty NameProperty = DependencyProperty.Register(...) or on the property: /// <summary>and/or here?</summary> public string Name{ get{......

WPF: Bindings not working correctly

Say I have XAML like <TabControl Grid.Row="1" Grid.Column="2" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True"> <TabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding TabTitle}" /> </DataTemplate> </TabControl.ItemTemplate> <TabControl.ContentTemplate> <DataTem...