WPF binden an die Inhaltseigenschaft von Content ControlC#

Ein Treffpunkt für C#-Programmierer
Guest
 WPF binden an die Inhaltseigenschaft von Content Control

Post by Guest »

Wie kann ich mich an die Inhaltseigenschaft von Inhaltskontrolle binden? public class CustomControl
{
// Dependency Properties
public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}

// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(MainViewModel), new PropertyMetadata(0));
}
< /code>

In ViewModel habe ich eine Eigenschaft vom Typ dieser benutzerdefinierten Steuerung erstellt: < /p>

public CustomControl CustomControl { get; set; }
< /code>

In der Ansicht binden ich diese Eigenschaft an die Inhaltskontrolle: < /p>


< /code>

Wie kann ich nun an die Inhaltseigenschaft von Content Control binden? < /p>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post