C
C#8mo ago
RV

❔ PopupModal dialog not fadeout or fadein

Popup Modal not fadeout when click close button, or when open from menu PopupModal.cs
using Kasir.Commons.Commands;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Kasir.Utils.Controls
{
internal class PopupModal : ContentControl
{

event EventHandler PopupClosed;
public ICommand DismissCommand { get; }

static PopupModal()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PopupModal), new FrameworkPropertyMetadata(typeof(PopupModal)));
}

public PopupModal()
{
DismissCommand = new RelayCommand(Dismiss);
}

private void Dismiss(object view) => IsOpen = false;

public bool IsOpen
{
get { return (bool)GetValue(IsOpenProperty); }
set {
SetValue(IsOpenProperty, value);
if (!value) PopupClosed?.Invoke(this, EventArgs.Empty);
}
}

public static readonly DependencyProperty IsOpenProperty =
DependencyProperty.Register("IsOpen", typeof(bool), typeof(PopupModal), new PropertyMetadata(false));

public string Header
{
get { return (string)GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public static readonly DependencyProperty HeaderProperty =
DependencyProperty.Register("Header", typeof(string), typeof(PopupModal), new PropertyMetadata("Message Popup"));
}
}
using Kasir.Commons.Commands;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Kasir.Utils.Controls
{
internal class PopupModal : ContentControl
{

event EventHandler PopupClosed;
public ICommand DismissCommand { get; }

static PopupModal()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PopupModal), new FrameworkPropertyMetadata(typeof(PopupModal)));
}

public PopupModal()
{
DismissCommand = new RelayCommand(Dismiss);
}

private void Dismiss(object view) => IsOpen = false;

public bool IsOpen
{
get { return (bool)GetValue(IsOpenProperty); }
set {
SetValue(IsOpenProperty, value);
if (!value) PopupClosed?.Invoke(this, EventArgs.Empty);
}
}

public static readonly DependencyProperty IsOpenProperty =
DependencyProperty.Register("IsOpen", typeof(bool), typeof(PopupModal), new PropertyMetadata(false));

public string Header
{
get { return (string)GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public static readonly DependencyProperty HeaderProperty =
DependencyProperty.Register("Header", typeof(string), typeof(PopupModal), new PropertyMetadata("Message Popup"));
}
}
3 Replies
RV
RV8mo ago
No one help me. I coding it manually. 😐
RV
RV8mo ago
Accord
Accord8mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.