CppXAML
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cppxaml::details::WrapperT< T > Struct Template Reference

Internal wrapper type that powers builder-style programming.
This type is usually constructed and destructed in a single declaration line, only serving to set properties on the underlying XAML element, or to add the element to a parent. More...

#include <cppxaml/Controls.h>

Inherited by cppxaml::details::Wrapper< T, TItems >.

Public Member Functions

auto Name () const
 Returns the element's Name.
 
auto Name (std::wstring_view n) const
 Set the element's Name.
 
auto Margin () const
 
auto Margin (cppxaml::xaml::Thickness t) const
 
auto Margin (double m) const
 
auto Margin (double left, double top, double right, double bottom) const
 
auto Padding () const
 
auto Padding (cppxaml::xaml::Thickness t) const
 
auto Padding (double m) const
 
auto Padding (double left, double top, double right, double bottom) const
 
template<typename TValue >
auto Set (cppxaml::xaml::DependencyProperty dp, TValue &&value)
 Sets a property.
 
auto VisualStates (const std::unordered_map< std::wstring, cppxaml::xaml::VisualStateChangedEventHandler > &map)
 Sets up a visual state change listeners.
 

Detailed Description

template<typename T>
struct cppxaml::details::WrapperT< T >

Internal wrapper type that powers builder-style programming.
This type is usually constructed and destructed in a single declaration line, only serving to set properties on the underlying XAML element, or to add the element to a parent.

Template Parameters
Tthe XAML element type to hold.

Member Function Documentation

◆ Margin() [1/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Margin ( ) const
inline
Returns

◆ Margin() [2/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Margin ( cppxaml::xaml::Thickness  t) const
inline
Parameters
tThickness struct
Returns

◆ Margin() [3/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Margin ( double  left,
double  top,
double  right,
double  bottom 
) const
inline
Parameters
left
top
right
bottom
Returns

◆ Margin() [4/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Margin ( double  m) const
inline
Parameters
mUniform length
Returns

◆ Name() [1/2]

template<typename T >
auto cppxaml::details::WrapperT< T >::Name ( ) const
inline

Returns the element's Name.

Returns

◆ Name() [2/2]

template<typename T >
auto cppxaml::details::WrapperT< T >::Name ( std::wstring_view  n) const
inline

Set the element's Name.

Parameters
n
Returns

◆ Padding() [1/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Padding ( ) const
inline
Returns

◆ Padding() [2/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Padding ( cppxaml::xaml::Thickness  t) const
inline
Parameters
tThickness struct
Returns

◆ Padding() [3/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Padding ( double  left,
double  top,
double  right,
double  bottom 
) const
inline
Parameters
left
top
right
bottom
Returns

◆ Padding() [4/4]

template<typename T >
auto cppxaml::details::WrapperT< T >::Padding ( double  m) const
inline
Parameters
mUniform length
Returns

◆ Set()

template<typename T >
template<typename TValue >
auto cppxaml::details::WrapperT< T >::Set ( cppxaml::xaml::DependencyProperty  dp,
TValue &&  value 
)
inline

Sets a property.

Template Parameters
TValue
Parameters
dpThe DependencyProperty to set
valueThe value
Returns

Example:

auto buttonInGrid = cppxaml::Button(L"Click me)
.Set(Grid::RowProperty(), 3)
.Set(Grid::ColumnProperty(), 2);
auto Button(C c)
Creates a Button.
Definition: Controls.h:604

◆ VisualStates()

template<typename T >
auto cppxaml::details::WrapperT< T >::VisualStates ( const std::unordered_map< std::wstring, cppxaml::xaml::VisualStateChangedEventHandler > &  map)
inline

Sets up a visual state change listeners.

Parameters
mapA map of visual state names to handlers
Returns

Example:

auto button = cppxaml::Button(L"click me")
.VisualStates( {
{ L"PointerOver", [](auto&sender, cppxaml::xaml::VisualStateChangedEventArgs args) {
auto x = args.NewState().Name();
auto button = sender.as<Controls::Button>();
button.Content(winrt::box_value(x));
} },
{ L"Normal", [](auto&sender, auto&) {
auto button = sender.as<Controls::Button>();
button.Content(winrt::box_value(L"click me"));
} },
});

The documentation for this struct was generated from the following file: