Hello @BitSmithy ,
Welcome to Microsoft Q&A!
mc:Ignorable="d"
d:DesignHeight="100"
d:DesignWidth="100"
According to the explanation in the XAML namespaces, currently we cannot get the properties after mc:Ignorable
.
" mc:" indicates and supports a markup compatibility mode for reading XAML. Typically, the "d:" prefix is associated with the attribute mc:Ignorable. This technique enables run-time XAML parsers to ignore the design attributes in "d:".
If you want to get the height and width in the xaml resource of Page or UserControl, please use Width
and Height
directly instead of d:DesignHeight
and d:DesignWidth
.
<UserControl
x:Class="XamlTest.MyUserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:XamlTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Width="100"
Height="100">
var height = myControl.ActualHeight;
var width = myControl.ActualWidth;
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.