小编Bri*_*n J的帖子

如何在WPF中的窗口之间导航?

我试图为打开另一个窗口的按钮设置一个单击事件,但我得到的错误NavigationService是该项目不包含它的定义.

这就是我目前试图调用页面的方式:

private void conditioningBtn_Click(object sender, RoutedEventArgs e)
{
    this.NavigationService.Navigate(new Uri("TrainingFrm.xaml", UriKind.RelativeOrAbsolute));
}
Run Code Online (Sandbox Code Playgroud)

有人能指出我正确的方向,或者显示这种窗口导航方法的替代方案吗?

c# wpf click

6
推荐指数
1
解决办法
3万
查看次数

如何在没有广播组的情况下取消选中单选按钮?

我已经使用以下代码片段来设置一个单选按钮以取消选中另一个单选按钮,但是当我运行应用程序并选择两个单选按钮时,代码不起作用,因为两者都保持选中状态.

我正在使用相对布局,所以我不能使用任何其他解决方案与无线电组,我只是使用两个单独的单选按钮.

有人可以指出我在哪里可能出错了,因为我看不出逻辑中的缺陷,任何想法?

无论如何,这是我试图实现的解决方案,但它不适用于应用程序:

public void onRadioButtonClicked(View view) {
        // Is the button now checked?
        boolean checked = ((RadioButton) view).isChecked();

        // Check which radio button was clicked
        switch(view.getId()) {
            case R.id.radBtnMM:
                if (checked)
                    //set inch button to unchecked
                     radioInch.setChecked(false);
                break;
            case R.id.radBtnInch:
                if (checked)
                    //set MM button to unchecked
                    radioMM.setChecked(false);
                break;
        }
    }
Run Code Online (Sandbox Code Playgroud)

android unchecked radio-button

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

如何将字符串中的小时、分钟和秒解析为 TimeSpan 对象?

我通过查询字符串传递一个字符串作为时间单位。但是,当我尝试将字符串解析为时间跨度对象时,我得到了一个System.FormatException' occurred in mscorlib.ni.dll but was not handled in user code我收集的信息,这意味着我格式化要解析的字符串的方式存在问题。

            if (NavigationContext.QueryString.ContainsKey("workTimeSpanPkr"))
            {
                testString = NavigationContext.QueryString["workTimeSpanPkr"];
                //Assign text box string value to a test time span variable.
                 testTm = TimeSpan.ParseExact(testString, @"hh\ \:\ mm\ \:\ ss", CultureInfo.InvariantCulture);

            }
Run Code Online (Sandbox Code Playgroud)

当我通过调试器运行它时传递​​的字符串 testString是:“00:15:04”``

有谁知道解析小时、分钟和秒的正确格式?

这是我试图解析的值以及我用来实现此目的的代码:

格式异常

工作字符串的值

c# parsing timespan string-formatting

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

如何增加行列式进度条的厚度?

我已经向 Windows 8.1 手机应用程序添加了一个行列式进度条,但我没有看到增加进度条粗细的方法。

我试图通过增加高度属性来改变厚度,但这对它的大小没有影响。

有谁知道如何增加红色进度条的高度/厚度?

这是我的 xaml 中进度条的声明:

    <ProgressBar IsIndeterminate="False" Maximum="100" Value="30" Width="200" Margin="128,240,128,262"/>
Run Code Online (Sandbox Code Playgroud)

进度条

c# progress-bar windows-phone-8.1

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

如何解决“ java.lang.InstantiationException”?

我正在使用SAX解析XML文件,但是当我在类上调用类加载器时,java.lang.InstantiationException会抛出a。

我通过例外的原因对此进行了调试:“当应用程序尝试使用Class类中的newInstance方法创建类的实例时抛出,但是指定的类对象由于是接口或抽象类而无法实例化。 '

但是location该类不是接口或抽象类。我还检查了该类是否在正确的包中。

有谁知道为什么在这种情况下会引发异常?

只是在Parser类的startElement中的第一个println之后引发异常:

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
        if (qName.equals("location")){
            location = true;

            System.out.println("Found a location...");
            //exception thrown after this statement as shown
            //in the error output below
            try {
                //Read in the values for the attributes of the element <location>
                int locationID = Integer.parseInt(atts.getValue("id"));
                String locationName = atts.getValue("name");

                //Generate a new instance of Location on-the-fly using reflection. The statement Class.forName("gmit.Location").newInstance(); invokes the 
                //Java Class …
Run Code Online (Sandbox Code Playgroud)

java xml sax classloader instantiationexception

5
推荐指数
1
解决办法
2万
查看次数

如何使用VisualStateManager而不是DataTrigger来实现动态绑定?

我试图实现DataTrigger,根据在视图中切换的切换按钮执行动态绑定.但在搜索问题之后,WinRT中的DataTrigger?看起来这在Windows Universal应用程序中不可用,而应该使用VisualStateManager.

我的问题是,如何使用VisualStateManager实现以下代码的等效代码?或者从视图模型后面的代码中的属性设置动态绑定的任何其他替代方法.

这是我打算使用的XAML,直到我遇到这个问题,其中默认绑定是OrdinaryGradePointKV,当切换按钮切换时,绑定更改为HigherGradePointKV:

<ComboBox
     Grid.Row="1"
     Grid.Column="0"
     Grid.ColumnSpan="2"
     Width="60"
     HorizontalAlignment="Right"
     DisplayMemberPath="Key">
     <ComboBox.Style>
         <Style>
             <Setter Property="ComboBox.ItemsSource" Value="{Binding OrdinaryGradePointKV}"></Setter>
             <Style.Triggers>
                 <DataTrigger Binding="{Binding IsHigherToggled}" Value="True">
                     <Setter Property="ComboBox.ItemsSource"
                         Value="{Binding HigherGradePointKV}" />
                 </DataTrigger>
             </Style.Triggers>
         </Style>
     </ComboBox.Style>
 </ComboBox>
Run Code Online (Sandbox Code Playgroud)

VM的精简版本如下所示,显示了绑定的属性:

namespace LC_Points.ViewModel
{

    public class MainViewModel : ViewModelBase
    {

        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            //call methods to initialize list data
            GetSubjectTypes();
            GetOrdinaryGradePairs();
            GetHigherGradePairs();
        }


        public List<Score> Subjects { get; set; …
Run Code Online (Sandbox Code Playgroud)

c# binding mvvm visualstatemanager win-universal-app

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

如何启用Bootstrap表分页和搜索?

我一直在遵循有关向Bootstrap表添加分页的两个指南,但是当我添加所需的链接和脚本时,分页或搜索不会在bootstrap表上呈现。

我尝试按照此解决方案的建议将jQuery引用放在head标签的开头,但这没什么区别。

我确定这只是外部库cdn引用的顺序不匹配,但我不确定正确的顺序。

我还检查了脚本是否引用了正确的表,即“升级”

题:

如何组织jquerybootstrap引用以显示表分页?

标记:(视图标记的要点)

<!DOCTYPE html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
    <script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>

    <link rel="stylesheet" type="text/css" href="media/css/jquery.dataTables.css">

    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container body-content">
        <div class="page-header">
            <label class="heading">History</label>
            <div class="form-group">
                <fieldset>
                    <form action="" class="form-group" method="post">
                        <div class="table-responsive">
                            <div class="table-responsive">                            

                                <table id="escalation" class="table table-striped table-bordered" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th>Application</th>
                                            <th>EMOPOP</th>
                                            <th>Stats</th>
                                            <th>Statement</th>
                                            <th>Time</th>
                                            <th>Updated</th>
                                            <th>Details</th> …
Run Code Online (Sandbox Code Playgroud)

datatable jquery pagination twitter-bootstrap

5
推荐指数
3
解决办法
5万
查看次数

如何在Max width上增加Bootstrap容器的宽度?

我在一个类型容器的Bootstrap div中放置了一个DataTable.当我在浏览器的最大宽度上运行网站时,表格的容器会添加滚动条并切断表格中的最后一列.

我确实尝试使用这里container-fluid建议的div类型,但这进一步减少了表容器的宽度.

在检查元素时,似乎container body-content在布局页面周围继承的表单是在表容器的左侧和右侧添加边距:

在此输入图像描述

一个可能的解决方案我正在考虑是否要减少继承container body-content最大宽度的余量,但我不知道如何通过CSS做到这一点.

从下面的屏幕截图中可以看到删除col被切断,尽管表中有足够的空白要扩展:

在此输入图像描述

题:

如何在Max width上增加Bootstrap容器的宽度?

表容器标记的要点:

<div class="container">


    <div class="form-group">
        <div class="table-responsive">
            <div class="table-responsive" id="datatable-wrapper">

                <table id="escalation" class="table table-striped table-bordered" cellspacing="0">
                    <thead>
                        <tr>
                            <th style="font-size: 12px; border-right: 1px solid #7591ac; ">ID</th>
                            <th style="font-size: 12px; border-right: 1px solid #7591ac; ">Application</th>
                            <th style="font-size: 12px; border-right: 1px solid #7591ac; ">UID</th>
                            <th style="font-size: 12px; border-right: 1px solid #7591ac; ">Type</th>
                            <th style="font-size: 12px; border-right: 1px solid #7591ac; ">Status</th>
                            <th style="font-size: …
Run Code Online (Sandbox Code Playgroud)

html css containers contentsize twitter-bootstrap

5
推荐指数
4
解决办法
2万
查看次数

如何在WPF中的图像上叠加图像?

我试图弄清楚如何在WPF中的图像上叠加图像或文本框.基本图像将托管来自Kinect传感器的视频输入,我想在其上叠加图像.例如,视频供稿将在Feed上有一个文本框,用于更新视频源顶部的计数器或树的图像.

在布局中是否有直接的方法来实现这一目标?这只是改变属性或添加画布的问题吗?

下图更好地说明了我正在尝试做的事情:

控制实时视频Feed

c# wpf overlay

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

如何将玩笑依赖模拟提升到实际依赖之上?

我正在测试一个导入 Class 的反应本机组件LanguageStore。目前测试失败,因为组件正在实例化此类,该类调用在测试范围内未定义的私有设置器:

\n\n
FAIL  src\\modules\\languageProvider\\__tests__\\LanguageProvider-test.js\n  \xe2\x97\x8f renders correctly\n\n    TypeError: _this.strings.setLanguage is not a function\n\n      at LanguageStore.setLanguage (src\\modules\\languageProvider\\LanguageStore.js:25:15)\n      at new LanguageProvider (src\\modules\\languageProvider\\LanguageProvider.js:30:16)\n
Run Code Online (Sandbox Code Playgroud)\n\n

问题:

\n\n

如何将玩笑依赖模拟提升到实际依赖之上?

\n\n

为了解决这个问题,我jest.mock根据这个答案调用了 How can I mock an ES6 module import using Jest? 。但我得到了与以前相同的错误,因为测试正在调用 LanguageStore 的实现而不是我在下面创建的模拟 - _this.strings.setLanguage is not a function

\n\n
import { View } from \'react-native\';\nimport React from \'react\';\nimport { shallow } from \'enzyme\';\nimport renderer from \'react-test-renderer\';\nimport connect from \'../connect.js\';\nimport LanguageProvider from \'../LanguageProvider\';\nimport LanguageStore from \'../LanguageStore\';\n\nit(\'renders …
Run Code Online (Sandbox Code Playgroud)

mocking jestjs react-native es6-class

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