在WinRT应用程序中访问用户控件的BorderBackground

时间:2015-02-25 07:03:23

标签: c# user-controls winrt-xaml windows-8.1

我有一个由两页组成的项目。一页是由我开发的用户控件的XAML。 另一页面具有裁剪该页面上图像框中存在的图像的逻辑。我想在该页面上使用我的控件,并将用户控件的边框背景指定给裁剪的图像。

The following code is of my UserControl XAML ! The cs file for this page has no code implementation

<UserControl
    x:Class="controlMagnifier.MagnifierUsercontrol"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:controlMagnifier"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">


    <Canvas x:Name="controlCanvas" x:FieldModifier="public" Margin="112,0,108,0">
        <Canvas.RenderTransform>
            <RotateTransform>

            </RotateTransform>
        </Canvas.RenderTransform>

        <Grid Height="250" Width="176" Canvas.Left="41" Canvas.Top="40" Margin="-40,0,0,0">
            <Border x:FieldModifier="public" x:Name="imgBorder" Width="150" CornerRadius="50,50,50,50" Margin="13,25,13,97">
                <Border.Background>
                    <ImageBrush  x:Name="image1"  ImageSource="/Assets/images.jpg" />
                </Border.Background>
            </Border>
            <TextBlock x:Name="txtreading" Height="30" Width="80" Margin="0,-145,0,0" FontWeight="Bold" Foreground="Red"  FontSize="20" Text="ABC" TextAlignment="Center" />
            <!--<Image Height="120" Width="150" Margin="0,-50,0,0" Source="Assets/SmallLogo.scale-100.png" ></Image>-->
            <Path x:Name="MagnifyTip"  Data="M25.533,0C15.457,0,7.262,8.199,7.262,18.271c0,9.461,13.676,19.698,17.63,32.338    c0.085,0.273,0.34,0.459,0.626,0.457c0.287-0.004,0.538-0.192,0.619-0.467c3.836-12.951,17.666-22.856,17.667-32.33    C43.803,8.199,35.607,0,25.533,0z M25.533,32.131c-7.9,0-14.328-6.429-14.328-14.328c0-7.9,6.428-14.328,14.328-14.328    c7.898,0,14.327,6.428,14.327,14.328C39.86,25.702,33.431,32.131,25.533,32.131z" Fill="#FFF4F4F5" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Height="227" Width="171" />


        </Grid>
    </Canvas>

</UserControl>

在用户控件XAML中,我们可以看到我已经设置了  到静态图像。我想将此用户控件访问到另一个页面,并希望将该元素分配给另一页上的裁剪图像输出。另一页MainPage.Xaml具有图像裁剪的代码。

任何帮助将不胜感激

0 个答案:

没有答案