public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Session.Object = new Info() { ForeGround = Brushes.White }; } private void Window_Loaded_1(object sender, RoutedEventArgs e) { //If I quick watch item. i got session object, and required foreground value is Ok. var item = this.FindResource("session"); } } //***************************************** public class Session { public static Info Object { get; set; } } //************************************** public class Info { public Brush ForeGround { get; set; } }
<Window.Resources> <local:Session x:Key="session"/> </Window.Resources> <Grid removed="Gray"> <Viewbox> <TextBlock Name="txt" Text="Hello Text" Foreground="{Binding Source={StaticResource session}, Path=Object.ForeGround}"/> </Viewbox> </Grid>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)