Search code examples
uwpwindows-community-toolkit

unable to set width height property of Teaching tip in UWP


Hi I am trying set width, the height of TeachingTip Class of UWP. But it is not working. Anyone know what is going on. That will help.


Solution

  • unable to set width height property of Teaching tip in UWP

    The TeachingTip control will automatically set the size base on the content size, if you want to modify it please add an element into the Content property and set element with pertinent size.

    <controls:TeachingTip         
        x:Name="ToggleThemeTeachingTip1"
        Title="Change themes without hassle"
        Subtitle="It's easier than ever to see control samples in both light and dark theme!"
        Target="{x:Bind ThemeButton}"
        >
        <controls:TeachingTip.IconSource>
            <controls:SymbolIconSource Symbol="Refresh" />
        </controls:TeachingTip.IconSource>
        <controls:TeachingTip.Content>
            <StackPanel Height="300">
                <TextBlock Text="t's easier than ever to see control samples in both light and dark theme!" TextWrapping="Wrap"/>
            </StackPanel>
        </controls:TeachingTip.Content>
    </controls:TeachingTip>
    

    Please note that the TeachingTip control has size limits in its default sesttings, for more please refer this . These default values for max. and min sizes should be overrriden so that the dynanic sizing based on the content can work:

    <x:Double x:Key="TeachingTipMinHeight">40</x:Double>
    <x:Double x:Key="TeachingTipMaxHeight">520</x:Double>
    <x:Double x:Key="TeachingTipMinWidth">320</x:Double>
    <x:Double x:Key="TeachingTipMaxWidth">336</x:Double>