Blog Stats
  • Posts - 62
  • Articles - 11
  • Comments - 9
  • Trackbacks - 62

 

Style matters!

Applying styles would be a walk in the park.

Take a look at the following example:

public style someCanvas
{
    Canvas{
        Rectangle MainRect{
            RadiusX=10; RadiusY=10;
            Width=100%; Height=100%;
            Fill=Alias(Target=Background);
        }
        FlowPanel{
            Width=100%; Height=100%;
            ContentPresenter{
                ContentControl.Content=Alias(Target = Content);
                Margin="15,3,15,5";
            }
        }
    }
}

public style roundButton
{
    Button{ FontSize="20"; }
    VisualTree = someCanvas;
}

public UI myBorder : Border
{
    Background=white;
    FlowPanel{ 
        Style = roundButton;
        Button{ 
            Style=roundButton; 
            Text="standard RoundButton";
        }
        Button{
            Background=red;
            Style=roundButton;
            Text="red RoundButton";
        }
        Button{
            Text="standard button";
        }
        Button{
            Background=red;
            Text="red standard button"
        }
    }
}

By now you should be able to understand and transform every XAML sample you can find on the web

I hope you had fun reading these tutorials.


Feedback

No comments posted yet.


Post a comment





 

 

 

Copyright © RebelGeekz