CXTPMarkupGridLength* CXTPMarkupDefinitionBase::GetUserSize() const
{
	CXTPMarkupGridLength* pValue = MARKUP_STATICCAST(CXTPMarkupGridLength, GetValue(m_bIsColumnDefinition ? CXTPMarkupColumnDefinition::m_pWidthProperty : CXTPMarkupRowDefinition::m_pHeightProperty));

	ASSERT(pValue);
	return pValue;
}
int CXTPMarkupGrid::GetRowSpan(CXTPMarkupUIElement* pElement)
{
	CXTPMarkupInt* pRowSpan = MARKUP_STATICCAST(CXTPMarkupInt, pElement->GetValue(m_pRowSpanProperty));
	if (!pRowSpan)
		return 1;

	return max(1, (int)*pRowSpan);
}
void CXTPMarkupInputElement::OnQueryCursor(CXTPMarkupQueryCursorEventArgs* e)
{
	CXTPMarkupInt* pCursor = MARKUP_STATICCAST(CXTPMarkupInt, GetValue(m_pCursorProperty));
	if (pCursor)
	{
		e->SetHandled();
		e->m_hCursor = AfxGetApp()->LoadStandardCursor(MAKEINTRESOURCE((int)*pCursor));
	}
}
void CXTPMarkupInputElement::OnStylePropertyChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* e)
{
	CXTPMarkupInputElement* pElement = MARKUP_DYNAMICCAST(CXTPMarkupInputElement, d);
	if (!pElement)
	{
		ASSERT(FALSE);
		return;
	}

	CXTPMarkupStyle* pStyle = MARKUP_STATICCAST(CXTPMarkupStyle, e->m_pNewValue);

	if (pStyle)
	{
		pStyle->Seal();
	}

	pElement->m_pStyleCache = pStyle;
}
XTPMarkupKeyboardNavigationMode CXTPMarkupKeyboardNavigation::GetTabNavigation(CXTPMarkupObject* pElement)
{
	CXTPMarkupEnum* pValue = MARKUP_STATICCAST(CXTPMarkupEnum, pElement->GetValue(m_pTabNavigationProperty));
	return pValue ? (XTPMarkupKeyboardNavigationMode)(int)*pValue : xtpMarkupKeyboardNavigationContinue;
}
AFX_INLINE BOOL GetBoolValue(CXTPMarkupObject* e, CXTPMarkupDependencyProperty* p)
{
	CXTPMarkupBool* pValue = MARKUP_STATICCAST(CXTPMarkupBool, e->GetValue(p));
	return pValue ? (BOOL)*pValue : FALSE;
}
int CXTPMarkupKeyboardNavigation::GetTabIndexHelper(CXTPMarkupObject* d)
{
	CXTPMarkupInt* pValue = MARKUP_STATICCAST(CXTPMarkupInt, d->GetValue(m_pTabIndexProperty));
	return pValue ? (int)*pValue : INT_MAX;
}
int CXTPMarkupGrid::GetRow(CXTPMarkupUIElement* pElement)
{
	CXTPMarkupInt* pRow = MARKUP_STATICCAST(CXTPMarkupInt, pElement->GetValue(m_pRowProperty));
	return pRow != NULL ? (int)*pRow : 0;
}
int CXTPMarkupGrid::GetColumn(CXTPMarkupUIElement* pElement)
{
	CXTPMarkupInt* pColumn = MARKUP_STATICCAST(CXTPMarkupInt, pElement->GetValue(m_pColumnProperty));
	return pColumn != NULL ? (int)*pColumn : 0;
}
int CXTPMarkupDefinitionBase::GetUserMaxSize() const
{
	CXTPMarkupInt* pMaxValue = MARKUP_STATICCAST(CXTPMarkupInt, GetValue(m_bIsColumnDefinition ? CXTPMarkupColumnDefinition::m_pMaxWidthProperty : CXTPMarkupRowDefinition::m_pMaxHeightProperty));
	return pMaxValue != NULL ? (int)*pMaxValue : INT_MAX;
}
CXTPMarkupBrush* CXTPMarkupPanel::GetBackground() const
{
	return MARKUP_STATICCAST(CXTPMarkupBrush, GetValue(m_pBackgroundProperty));
}