OAC Technology
asked on
Cannot trigger UWP application windows change from C# script.
I have a button in my UWP application that is set to change a variable that controls whether a StackPanel shows up or not. For some reason, this is not working. There is a similar function that changes it to FALSE that works just fine. If I start with it being TRUE (starts with the stackpanel open) and close it and then hit the same button an error appears that doesn't appear otherwise. "Â Exception thrown: 'System.InvalidCastExcepti on' "
xaml
C#
xaml
<AppBarButton Click="{x:Bind OpenRecords.OpenNewTicketAsync}" Icon="Add" Label="New Ticket" ToolTipService.ToolTip="New Ticket"/>
<StackPanel x:Name="OpenCustomerPanel" Orientation="Horizontal" x:Load="{x:Bind OpenRecords.NewOpenTicket, Mode=OneWay}" RelativePanel.Below="OpenCommandBar">
C#
public event PropertyChangedEventHandler PropertyChanged;
private bool _NewOpenTicket = false;
public void OnPropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void OpenNewTicketAsync()
{
NewOpenTicket = true;
}
public bool NewOpenTicket
{
get => _NewOpenTicket;
set
{
if (_NewOpenTicket != value)
{
_NewOpenTicket = value;
OnPropertyChanged();
}
}
}
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.