Kind of an odd question- if I'm thinking of this the wrong way please let me know. I am using an infragistics dock manager, which manages tabs as well. So I can create a TabGroupPane, and then add multiple ContentPanes, each of which has its own tab.
In each content pane, I set my viewmodel:
<ContentPane>
<viewmodels:MyViewModelFor...
When is the right time to use dependency properties? Should every property in you ViewModel be a dependency property? Should only certain properties be dependency properties? If there is an editable DataGridView, should all the properties be dependency properties?
...
System.TypeInitializationException was unhandled
Message=The type initializer for 'SmartHomeworkOrganizer.ViewModels.MainViewModel' threw an exception.
Source=SmartHomeworkOrganizer
TypeName=SmartHomeworkOrganizer.ViewModels.MainViewModel
StackTrace:
at SmartHomeworkOrganizer.ViewModels.MainViewModel..ctor()
at Smar...
My code currently looks like this:
private Foo myFoo;
public Foo CurrentFoo
{
get { return myFoo; }
set { SetFoo(value); }
}
private void SetFoo(Foo newFoo)
{
// Do stuff
// Here be dragons
myFoo = newFoo;
}
To be able to bind it in XAML/WPF I need to turn Foo into a dependency property:
public static Dependenc...
Hi!
I would like to use a TabControl as the main navigation in the application I am working on. So I would like to make the font in the headers of the TabItems bigger and also give it another background-color. However, I do not want this to be inherited. For example,
if I use this code:
<TabControl FontSize="18pt">
<TabItem Header="T...
I have the following dependency property inside a class:
class FooHolder
{
public static DependencyProperty CurrentFooProperty = DependencyProperty.Register(
"CurrentFoo",
typeof(Foo),
typeof(FooHandler),
new PropertyMetadata(OnCurrentFooChanged));
private static void OnCurrentFooChanged(Depende...
Hi there,
So i have a UserControl for one of my Views and have another 'child' UserControl inside that.
The outer 'parent' UserControl has a Collection on its View-Model and a Grid control on it to display a list of Items.
I want to place another UserControl inside this UserControl to display a form representing the details of one I...
I'm trying to figure out what exactly Dependency Properties are, but when I look anywhere for a definition, I only find "how to use" but not "what it is".
Imagine you are asked on a job interview - what is a dependency property. What would be your answer?
...
I'm on a roll today...
I have the following code delaring a dependency property inside a class called ActionScreen:
#region Dependency Properties & Methods
public string DescriptionHeader
{
get { return (string)GetValue(DescriptionHeaderProperty); }
set { SetValue(DescriptionHeaderProperty, value); }
}
// Using a DependencyPr...
I want to use a color picker in my wpf application and I saw a nice looking one on this codeproject page. The control works fine until I want to connect the control to a viewmodel.
I created a small test program with this viewmodel:
public class ColorViewModel : ViewModelBase
{
public ColorViewModel()
{
LineColor = Brush...
I'm trying to animate a private variable named radius, which works. However while its changing I'm trying to execute a function which is getting to be quite of a problem.
the code i have is below, it wont run because it has the following error
An object reference is required for the non-static field, method, or property 'AppPart.SetChil...
I'm trying to createa time-tracking application in WPF. The user is supposed to draw elements that represent a timespan (timespan = bar) onto a Canvas.
Now, exisiting bars are added when they are databound to a collection (each collection item contains the width and left position of the bar on the Canvas).
The 'bar' Usercontrol has a de...
For the sake of argument, here's a simple person class
public class Person : DependencyObject, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public static readonly DependencyProperty FirstNameProperty =
DependencyProperty.Register( "FirstName",
ty...
Hello,
is it because the controls programmers are lazy, too hard to implement or not knowledgeable?
Wether they are custom controls from 3rd party vendors or Microsoft itself, very much controls have often clr properties instead of DP. Result is I can not bind to them and is wpf not all about binding? :/
My next side question would be...
Is there a way to notify a DependencyObject's bindinigs when the inner DependencyProperties have changed?
For example, I have this class:
public class BackgroundDef : DependencyObject
{
public static readonly DependencyProperty Color1Property =
DependencyProperty.Register("Color1", typeof(Color),
...
So, I have a control. It displays an image based some xml document and an optional parameter
"Document" - XML document
"RenderingOption" - optional image-rendering ( sharpen, soften )
So:
<XMLRenderingWidget Document="xxxxxx"/>
The above will render the document once
<XMLRenderingWidget Document="xxxxxx" RenderingOption="Sharpe...
Hi
We have a user control with a custom dependency property (DP). The DP is bound to an ObservableCollection.
When a new item is added to the collection programatically, the databinding does not update the target DP. Why? We think it's because, unfortunately, in our case the target is not a ListBox or ListView, but a Canvas. The DP, whe...
This is what I'm trying to do:
I'm writing a UserControl that I want to be consumed by other developers.
I want end users to be able to use my control using Dependency Properties.
<lib:ControlView ControlsText={Binding Path=UsersOwnViewModelText} />
I'm using the MVVM pattern.
I'm binding my ViewModels to their View's using <DataTempl...
Hi,
I was trying to use tis depencency property in my code but it gives me error says that Default value type does not match type of property 'MyProperty'.But short should accept 0 as default value.Ans also if i try to give null as default value it works..even if its a non nullabel type.How come this happens..
public short MyProperty
...
I'm creating a WPF app using the MVVM design pattern, and I'm trying to extend the TabItem control so that it closes the tab when the user clicks the middle mouse button. I'm trying to achieve this using InputBindings, and it works very well until I try to define it within a style. I've learned that you cannot add InputBindings to a sty...