小编Nee*_*ati的帖子

找不到资源'application_startup'

我刚刚开始WPF.我正在startupURI从代码后面分配页面.它给了我这个错误:

找不到资源'application_startup'"

这是我在App.xaml中所做的

<Application x:Class="HelloWpf.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="Application_Startup">
<Application.Resources>

</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

这是我在App.xaml.cs文件中所做的:

 private void Application_Startup(object sender, StartupEventArgs e)
    {
        // Create the startup window
        MainWindow wnd = new MainWindow();
        // Do stuff here, e.g. to the window
        wnd.Title = "Something else";
        // Show the window
        wnd.Show();

        //Application.Current.MainWindow = wnd;
        //wnd.InitializeComponent();
        //wnd.Show();
    }
Run Code Online (Sandbox Code Playgroud)

请帮助这个简单的代码有什么问题.谢谢

wpf

2
推荐指数
2
解决办法
962
查看次数

如何在xamarin.forms中获取状态栏的高度?

我正在尝试在应用程序中获取状态/操作栏的高度。我了解了一些如何在本机android中获取它的方法。我们可以在xamarin.forms中获取状态/操作栏的高度吗?如果有人对此有所帮助,请提供帮助。 在此处输入图片说明

size statusbar xamarin.forms

2
推荐指数
2
解决办法
2459
查看次数

在按钮悬停时将文本和路径更改为不同颜色

我有一个包含路径和文本的按钮.就像这样

在此输入图像描述

在悬停按钮时,它应该像这样改变颜色 在此输入图像描述

这是我已经完成的Xaml文件

<Button  Grid.Row="1" Grid.Column="0" Style="{StaticResource DashBordMenuButton}" >
            <StackPanel >
                <Path Name="DIcon1" Data="{StaticResource IconReporting}" Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"  HorizontalAlignment="Center"  ></Path>
                <TextBlock HorizontalAlignment="Center" Margin="0,10,0,0" > DASHBORD</TextBlock>
                <TextBlock  LineHeight="25" TextWrapping="Wrap" LineStackingStrategy="BlockLineHeight" Margin="0,20,0,0" Text="Minir All Servers,Clients and Activies"></TextBlock>
            </StackPanel>
        </Button>
Run Code Online (Sandbox Code Playgroud)

样式

<Style x:Key="DashBordMenuButton" TargetType="Button">

    <Setter Property="Margin" Value="10"></Setter>
    <Setter Property="Background" Value="White"/>
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Border Name="border" BorderThickness="1,1,1,4" BorderBrush="Gray" Background="{TemplateBinding Background}">
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="#FF36D8E0"/> …
Run Code Online (Sandbox Code Playgroud)

wpf button hover

1
推荐指数
1
解决办法
717
查看次数

使用#if检查时,未定义的变量是否应该抛出异常?

using System;
public class Program
{
    public static void Main(string[] args)
    {
    #if (!pi)
                Console.WriteLine("i");
    #else 
                Console.WriteLine("PI undefined");
    #endif
        Console.WriteLine("ok");
        Console.ReadLine();
    }
}
Run Code Online (Sandbox Code Playgroud)

输出:


还好

任何人都可以向我解释如何?如果pi没有定义,它不应该抛出异常吗?

c#

1
推荐指数
1
解决办法
248
查看次数

标签 统计

wpf ×2

button ×1

c# ×1

hover ×1

size ×1

statusbar ×1

xamarin.forms ×1