Closed tobitech closed 9 years ago
Hi @tobitech, can you please paste the XAML you're trying to use? In what method are you trying to change those properties manually?
This is my xaml
<i:Interaction.Behaviors>
<cimbalinoBehaviors:ApplicationBarBehavior>
<!--<cimbalinoBehaviors:ApplicationBarIconButton x:Name="home"
IconUri="/Assets1/AppBar/basecircle.png"
Text="home"
IsEnabled="True"
Click="home_Click"/>-->
<cimbalinoBehaviors:ApplicationBarIconButton x:Name="pcappbar"
IconUri="/Assets1/AppBar/send.text.png"
Text="comment"
IsEnabled="True"
Click="pcappbar_Click"/>
<cimbalinoBehaviors:ApplicationBarIconButton x:Name="shareappbar"
IconUri="/Assets1/AppBar/share.png"
Text="share"
IsEnabled="True"
Command="{Binding ShareButtonCommand,Mode=TwoWay}"/>
<cimbalinoBehaviors:ApplicationBarIconButton x:Name="dvappbar"
IconUri="/Assets1/AppBar/download.png"
Text="download"
IsEnabled="True"
IsVisible="True"
Click="downloadappbar_Click"/>
<cimbalinoBehaviors:ApplicationBarBehavior.MenuItems>
<cimbalinoBehaviors:ApplicationBarMenuItem x:Name="vcmenu"
Text="view comments"
IsEnabled="True"
Click="vcmenu_Click"/>
<cimbalinoBehaviors:ApplicationBarMenuItem x:Name="rvmenu"
Text="report this video"
IsEnabled="True"
Click="rvmenu_Click"/>
<!--<cimbalinoBehaviors:ApplicationBarMenuItem x:Name="dvmenu"
Text="download"
IsVisible="True"
IsEnabled="True"
Click="downloadappbar_Click"/>-->
</cimbalinoBehaviors:ApplicationBarBehavior.MenuItems>
</cimbalinoBehaviors:ApplicationBarBehavior>
</i:Interaction.Behaviors>
and it's like, IsEnabled wasn't set in your sample project code
IsEnabled = True
and IsVisible = True
are the default values, should be no need to put those in!
Can you post the complete stack trace of the exception also?
StackTrace at VideoDetailPage.
dvappbar.IsEnabled = false;
on the OnNavigatedTo event of the page
Ok, that's it then: dvappbar
is null, as you can't use x:Name
on behavior elements!
So what should I do to control the Visibility or it's enability?
Ideally you should do that from the ViewModel, just binding to those properties!
I will do that, thanks for attending to me. I'm sorry I created the first issue on this repo
No problem! :) closing this for now!
I tried to bind the IsVisible property of an applicationbariconbutton to a property in a ViewModel but didn't work, so I then tried to control the visibility and it's IsEnabled property in the code behind but it throws a System.NullReferenceException and tells me to check to see if it null