Created
November 19, 2019 13:21
-
-
Save Bert-Proesmans/ac7bb7311deca94839758b0b67b8190c to your computer and use it in GitHub Desktop.
Loading custom control
This file contains hidden or 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
public class LoadingControl : UserControl | |
{ | |
public static readonly DependencyProperty TaskHandlerProperty = | |
DependencyProperty.Register(nameof(TaskHandler), typeof(ITaskHandler), typeof(Loading), | |
new FrameworkPropertyMetadata("")); | |
public Loading() | |
{ | |
InitializeComponent(); | |
} | |
public ITaskHandler TaskHandler | |
{ | |
get => (ITaskHandler)GetValue(TaskHandlerProperty); | |
set => SetValue(TaskHandlerProperty, value); | |
} | |
private static void OnHandlerChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) | |
{ | |
// TODO; Register listeners on the new TaskHandler dependencyproperty | |
// bool ITaskHandler.IsBusy will indicate if there is work performing in the background or not | |
} | |
private void OnTaskBusyChanged(object sender, PropertyChangedEventArgs e) { | |
// TODO; Switch the visibility of the current control: | |
// Visible on IsBusy == true | |
// Collapsed on IsBusy == false | |
} | |
} |
This file contains hidden or 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
<usercontrol> | |
<Border height="50pt"> | |
<TextBlock Text="Loading.."/> | |
</border> | |
</usercontrol> |
This file contains hidden or 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
<usercontrol> | |
<grid> | |
[CONTENTS] | |
<loadingcontrol verticalalignment="bottom" TaskHandler="{Binding}"/> | |
</grid> | |
</usercontrol> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment