public ReadLocalValue ( |
||
dp | ||
return | object |
public void GetLocalValue() { Button myButton = new Button(); myButton.Content = "Click Me!"; myButton.SetValue(Button.ForegroundProperty, Brushes.Red); SolidColorBrush brush = (SolidColorBrush)myButton.ReadLocalValue(Button.ForegroundProperty); Console.WriteLine("Current foreground: " + brush.Color); }In this example, we create a new Button control and set its foreground property to the color red. We then use the ReadLocalValue method to retrieve the current value of the foreground property and print it to the console. The package library for this class is the PresentationFramework.dll. This library is part of the WPF (Windows Presentation Foundation) framework, which provides a set of UI controls, graphics, and media features for creating Windows desktop applications.