<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:appStyles="clr-namespace:MyWin" x:Class="MyWin.WinEvent"> <Style x:Key="WindowStyle1" TargetType="{x:Type Window}" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Border Name="Border1"> <Grid > <Button DataContext="{x:Type appStyles:WinEvent}" Content="{Binding _Static}" Name="ButtonClick" HorizontalAlignment="Stretch" Height="51.443" Margin="1,0,0,0" VerticalAlignment="Top" Width="Auto"> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> <EventSetter Event="Loaded" Handler="Load"/> </style> </ResourceDictionary>
namespace MyWin { partial class WinEvent { private string _Static; public string State { get { return _Static; } set { if (value != _Static) { _Static = value; } } } private void Load(object sender, EventArgs e) { State = "Click"; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)