Created
October 21, 2020 10:26
-
-
Save jespersh/f22fbcfa8562cc71db8f7c76e441df70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="WpfApp5.MainWindow" | |
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" | |
xmlns:local="clr-namespace:WpfApp5" | |
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="450" Width="800"> | |
<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition/> | |
<RowDefinition/> | |
</Grid.RowDefinitions> | |
<Grid.Resources> | |
<Storyboard x:Key="InformationStoryboard"> | |
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Width"> | |
<EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0" /> | |
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="12" /> | |
</DoubleAnimationUsingKeyFrames> | |
</Storyboard> | |
</Grid.Resources> | |
<materialDesign:PackIcon Name="SortDirectionIndicator"> | |
<materialDesign:PackIcon.Style> | |
<Style TargetType="{x:Type materialDesign:PackIcon}" BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}"> | |
<Style.Triggers> | |
<DataTrigger Binding="{Binding ProfileInformation.IsExpired}" Value="True"> | |
<DataTrigger.EnterActions> | |
<BeginStoryboard x:Name="iconstoryboard" Storyboard="{StaticResource InformationStoryboard}"/> | |
</DataTrigger.EnterActions> | |
<DataTrigger.ExitActions> | |
<RemoveStoryboard BeginStoryboardName="iconstoryboard"/> | |
</DataTrigger.ExitActions> | |
</DataTrigger> | |
<DataTrigger Binding="{Binding ProfileInformation.IsExpired}" Value="True"> | |
<Setter Property="Kind" Value="InformationCircle"></Setter> | |
</DataTrigger> | |
<DataTrigger Binding="{Binding ProfileInformation.IsExpired}" Value="False"> | |
<Setter Property="Kind" Value="FaceProfile"></Setter> | |
</DataTrigger> | |
</Style.Triggers> | |
</Style> | |
</materialDesign:PackIcon.Style> | |
</materialDesign:PackIcon> | |
<CheckBox Grid.Row="1" IsChecked="{Binding ProfileInformation.IsExpired}">ProfileInformation.IsExpired</CheckBox> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
using System.Windows.Navigation; | |
using System.Windows.Shapes; | |
namespace WpfApp5 | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public ProfileInformation ProfileInformation { get; set; } | |
public MainWindow() | |
{ | |
ProfileInformation = new ProfileInformation(); | |
InitializeComponent(); | |
DataContext = this; | |
} | |
} | |
public class ProfileInformation : INotifyPropertyChanged | |
{ | |
private bool isExpired; | |
public bool IsExpired | |
{ | |
get => isExpired; set | |
{ | |
isExpired = value; | |
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsExpired))); | |
} | |
} | |
public event PropertyChangedEventHandler PropertyChanged; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment