locked
Windows.UI.Xaml and Xaml.Visibility

    General discussion

  • This is not really a problem, but it is still something I would like to know the answer to. When setting the Visibility property of elements in my design using the codebehind, the Intellisense in Visual Studio 2013 gives me the options of Xaml.Visibility.Collapsed or Xaml.Visibility.Visible. These are, as we know, the two options, but why does it try to make us include the Xaml namespace? Regardless of whether Windows.UI.Xaml is included in the imported namespaces, all that is necessary is Visibility.Collapsed or Visibility.Visible, so I usually remove the Xaml. from my code to keep it as short as possible, but this is extra editing that I think Visual Studio 2013 should be doing for us. Why does it do this, and is there a fix or workaround for it? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Tuesday, November 18, 2014 1:22 AM

All replies

  • Try fully qualifying the Visibility class.  From the error it is finding Windows::UI::Xaml::UIElement::Visibility, but you want Windows::UI::Xaml::Visibility.

    void SmartPrinter::PrinterControlPanel::AlignButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
     
    {
           this->AlignmentGrid->Visibility = Windows::UI::Xaml::Visibility::Visible; 
    }
    
    
    Friday, November 21, 2014 1:48 AM
  • As I stated in the original post, this is not an error, it is simply a comment about Intellisense and how I can avoid having it add longer code than necessary.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Friday, November 21, 2014 2:38 AM