I have made a method (in a seperate cs file) to check if the FTP navigation has reached the "home" location
"/mnt/media_rw/C8D2F97eD2g27154"
.
When it has done this, it should collapse the Back button, and if not the back button should be visible.
The button is per default Collapsed.
public bool FTPcheckFolder(string FTPFolder)
{
NfoCreator nfoCreator = new NfoCreator();
if (FTPFolder == "/mnt/media_rw/C8D2F97eD2g27154")
{
nfoCreator.btn_FtpFolderBack.Visibility = Visibility.Collapsed;
return true;
}
else
{
nfoCreator.btn_FtpFolderBack.Visibility = Visibility.Visible;
return false;
}
}
With my code I get the correct boolean value back when I include it in the messagebox tag, but the control will not collapse.
When I run it as debug, I see that
nfoCreator.btn_FtpFolderBack.Visibility = Visibility.Collapsed;
This is my xaml button -
<Button x:Name="btn_FtpFolderBack" Content="<< Back" HorizontalAlignment="Left" Height="19" Margin="383,23,0,0" VerticalAlignment="Top" Width="54" Click="btn_FtpFolderBack_Click" Visibility="Collapsed" x:FieldModifier="public"/>
The FieldModifier tag, I just tested with but not too sure about it
Hope somebody has some good ideas, thanks
What I have tried:
When I use this code in the forms cs file, it works fine -
Sharing sharUtil = new Sharing();
if (sharUtil.FTPcheckFolder(ftptmpfolder))
{
btn_FtpFolderBack.Visibility = Visibility.Collapsed;
}
else
{
btn_FtpFolderBack.Visibility = Visibility.Visible;
}
When I run it like
sharUtil.FTPcheckFolder(ftptmpfolder)
it will not collapse or make the button visible.
When perform a debug step into the method, it seems to work on the correct controle sets it correctly. The content on the button is ">> Back" so I think its fine
From Debug (Name - Value - Type)-
nfoCreator.btn_FtpFolderBack -
{System.Windows.Controls.Button: << Back}
- System.Windows.Controls.Button
nfoCreator.btn_FtpFolderBack.Visibility -
Collapsed
- System.Windows.Visibility