8,735
社区成员
发帖
与我相关
我的任务
分享
<UserControl x:Class="SilverlightNavigate.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Height="100" Width="550">
<UserControl.Resources>
<Style x:Key="NavigateBtnStyle" TargetType="Button">
<Setter Property="Background" Value="#FF1F3B53"/>
<Setter Property="Foreground" Value="#FF000000"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.3000000" To="Normal"/>
<VisualTransition GeneratedDuration="00:00:00.3000000" To="MouseOver"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-30"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused"/>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Button x:Name="button" Margin="0" VerticalAlignment="Top" Width="90" Height="90">
<Button.Projection>
<PlaneProjection/>
</Button.Projection>
<TextBlock x:Name="content" Text="{TemplateBinding Content}"></TextBlock>
</Button>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Canvas Height="100" VerticalAlignment="Top">
<Button x:Name="btnSelRoomType" Height="90" Width="90" Canvas.Left="10" Canvas.Top="8" Content="查看客房类型" FontSize="13.333" Click="btnSelRoomType_Click" />
<Button Height="90" Width="90" Canvas.Left="120" Canvas.Top="8" Content="增加客房类型" FontSize="13.333" Style="{StaticResource NavigateBtnStyle}"/>
<Button Height="90" Width="90" Canvas.Left="230" Canvas.Top="8" Content="查看客房信息" FontSize="13.333" Style="{StaticResource NavigateBtnStyle}"/>
<Button Height="90" Width="90" Canvas.Left="340" Canvas.Top="8" Content="增加客房信息" FontSize="13.333" Style="{StaticResource NavigateBtnStyle}"/>
<Button Height="90" Width="90" Canvas.Left="450" Canvas.Top="8" Content="管理客房" FontSize="13.333" Style="{StaticResource NavigateBtnStyle}"/>
</Canvas>
</UserControl>
namespace SilverlightNavigate
{
public partial class MainPage : UserControl
{
HtmlWindow win = HtmlPage.Window;
HtmlDocument document = HtmlPage.Document;
public MainPage()
{
InitializeComponent();
}
//click事件没用
private void btnSelRoomType_Click(object sender, RoutedEventArgs e)
{
var myEle=document.GetElementById("Text1");
myEle.SetAttribute("value", "dfdfdf");
}
}
}
private void btnSelRoomType_Click(object sender, RoutedEventArgs e)
{
HtmlElement element = HtmlPage.Document.CreateElement("input");
element.SetAttribute("value", "1234");
HtmlPage.Document.Body.AppendChild(element);
}
执行成功