Windows :: UI :: Xaml :: Horizo​​ntalAlignment与Windows :: UI :: Xaml :: FrameworkAlignment :: Horizo​​ntalAlignment [英] Windows::UI::Xaml::HorizontalAlignment versus Windows::UI::Xaml::FrameworkAlignment::HorizontalAlignment

查看:45
本文介绍了Windows :: UI :: Xaml :: Horizo​​ntalAlignment与Windows :: UI :: Xaml :: FrameworkAlignment :: Horizo​​ntalAlignment的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Horizo​​ntalAlignment实际上是我有一个using语句的Windows :: UI :: Xaml的成员,我很困惑为什么


  Horizo​​ntalAlignment :: Center产生以下编译器错误:



blankpage.xaml.cpp(43):错误C2039:'中心':不是'Windows :: UI :: Xaml :: FrameworkElement :: Horizo​​ntalAlignment'的成员



 

使用命名空间Windows :: UI :: Xaml;


void BlankPage :: OnNavigatedTo(NavigationEventArgs ^ e)
{
TextBlock ^ dynTextBlock = ref new TextBlock();

dynTextBlock-> Text =" dynTextBlock动态创建" ;;
dynTextBlock-> Horizo​​ntalAlignment = Windows :: UI :: Xaml :: Horizo​​ntalAlignment :: Center;
dynTextBlock-> Horizo​​ntalAlignment = Horizo​​ntalAlignment :: Center;
myGrid-> Children-> Append(dynTextBlock);
}

// Intellisense显示Windows :: UI :: Xaml :: Horizo​​ntalAlignment和Windows :: UI :: Xaml :: FrameworkAlignment :: Horizo​​ntalAlignment

< span style ="font-size:small"> // for dynTextBlock->水平对齐

解决方案

 

Hello,


 


我认为编译器将Horizo​​ntalAlignment视为FrameworkElement。 Horizo​​ntalAlignment属性


http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.frameworkelement.horizo​​ntalalignment


 


所以你需要添加它的整个路径。


 


祝你好运,


杰西


Since HorizontalAlignment is in fact a member of Windows::UI::Xaml to which I have a using statement, I'm puzzled why

 HorizontalAlignment::Center produces the following compiler error:

blankpage.xaml.cpp(43): error C2039: 'Center' : is not a member of 'Windows::UI::Xaml::FrameworkElement::HorizontalAlignment'

using namespace Windows::UI::Xaml; void BlankPage::OnNavigatedTo(NavigationEventArgs^ e) { TextBlock^ dynTextBlock = ref new TextBlock(); dynTextBlock->Text= "dynTextBlock created dynamically"; dynTextBlock->HorizontalAlignment= Windows::UI::Xaml::HorizontalAlignment::Center; dynTextBlock->HorizontalAlignment= HorizontalAlignment::Center; myGrid->Children->Append( dynTextBlock ); }

// Intellisense displays Windows::UI::Xaml::HorizontalAlignment and Windows::UI::Xaml::FrameworkAlignment::HorizontalAlignment

// for dynTextBlock->Horizontal alignment

解决方案

 

Hello,

 

I think the complier treat HorizontalAlignment as the FrameworkElement.HorizontalAlignment property

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.frameworkelement.horizontalalignment

 

So that you need to add the whole path of it.

 

Best regards,

Jesse


这篇关于Windows :: UI :: Xaml :: Horizo​​ntalAlignment与Windows :: UI :: Xaml :: FrameworkAlignment :: Horizo​​ntalAlignment的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆