我在数据库中有大约10个非常简单的表:
create table EmploymentStatus
(
Id int identity(1,1) Primary Key,
Name nvarchar(100) NOT NULL
)
Run Code Online (Sandbox Code Playgroud)
这些表用于DropDownLists注册视图,如下所示:
@Html.DropDownListFor(m => m.EmploymentStatus, Model.EmploymentStatusList, Resource.EmploymentStatus, new { @class = "form form-control" })
Run Code Online (Sandbox Code Playgroud)
DropDownListFor需要IEnumerable<SelectListItem> selectList一个集合.所以,我创建了一个方法:
public static List<SelectListItem> ToSelectItemList(IQueryable<EmploymentStatu> statuses)
{
return statuses.Select(m => new SelectListItem
{
Text = m.Name,
Value = m.Id.ToString()
}).ToList();
}
Run Code Online (Sandbox Code Playgroud)
问题是我必须为十个实体中的每一个创建一个方法.是否有一种编写通用方法的好方法,如下所示:
public static List<SelectListItem> ToSelectItemList(IQueryable<T> collection)
{
return collection.Select(m => new SelectListItem
{
Text = m.Name,
Value = m.Id.ToString()
}).ToList();
}
Run Code Online (Sandbox Code Playgroud) 我已经使用Xamarin.Forms中的oxyplot成功生成了一个情节,但是我无法阻止整个页面的氧气图.
我在旋转木马的其他页面上使用stacklayout,并且在每个页面上都有一个横幅作为嵌入式stacklayout,并且希望将绘图显示在下面的嵌入式stacklayout中.
但横幅短暂出现,然后由氧气图写过.
我发现引用Grid应该使用Grid而不是stacklayout,因为存在已知问题,但网格也不起作用.
任何帮助感激不尽!这可能是一个约束性问题,例如,如果我删除Model ="{Binding Model}"它仍然有效!它忽略了HeightRequest ="100"而只是填充页面.我显然在这里遗漏了一些东西.
这是xaml代码,我已经注释掉了网格尝试,"oxy:PlotView"中的各种选项是我尝试的最后一个:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="RentGuru2.PieCosts"
xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
Padding="0, 20, 0, 0"
BackgroundColor="#21b09c">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal" BackgroundColor="#21b09c" HeightRequest="60">
<Image Source = "BannerLogo.png" />
<Label Text="Costs breakdown" FontSize="Large" TextColor="White" Margin="10" VerticalTextAlignment="Center"/>
</StackLayout>
<StackLayout HeightRequest="300">
<oxy:PlotView Model="{Binding Model}" VerticalOptions="Center" HorizontalOptions="FillAndExpand"
HeightRequest="100" WidthRequest="100" />
</StackLayout>
</StackLayout>
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Grid.Row="0" Grid.Column ="0" Source = "BannerLogo.png" />
<Label …Run Code Online (Sandbox Code Playgroud) 在CodeIgniter中,如何从单独的文件而不是默认的config \ database.php加载数据库?
可以说,在库下,我有一个名为db_configs的文件夹。在每个数据库中,详细信息将存储在单独的文件中,例如。DB_01.php,DB_02.php等。
谢谢,
我正在使用Xceed的PropertyGrid来显示某些元素的特征.元素有不同的类别,如:General,Advanced,Others,Special.在这里,我发现Xceed的propertygrid按字母顺序对类别和属性进行排序.我能够通过使用来对类别内的属性进行排序[PropertyOrder(n)].我也想对类别进行排序,我尝试使用CategoryOrder类似[CategoryOrder("General", 0)]但它显示以下错误:
错误2属性"CategoryOrder"在此声明类型上无效.它仅对"类"声明有效.
我用错了吗?下面提供的代码只是一个示例,以显示我如何使用它.
[Category("General")]
[CategoryOrder("General", 0)]
[DisplayName("XValue")]
[Description("Value of X-Coordinate")]
[ReadOnly(true)]
[PropertyOrder(1)]
[Category("Advanced")]
[CategoryOrder("Advanced", 1)]
[DisplayName("Collision")]
[Description("Collision")]
[ReadOnly(true)]
[PropertyOrder(1)]
[Category("Others")]
[CategoryOrder("Others", 3)]
[DisplayName("Traffic")]
[Description("Traffic at a point")]
[ReadOnly(true)]
[PropertyOrder(1)]
[Category("Special")]
[CategoryOrder("Special", 2)]
[DisplayName("Special cases")]
[Description("Contains the special cases and files")]
[PropertyOrder(1)]
Run Code Online (Sandbox Code Playgroud) 我试图更改 ListView 项目在选定时和悬停时的外观。我已经尝试过其他建议使用 Style.Trigger 的问题的答案,但不知何故这对我不起作用。它目前看起来像这样: 现在的样子的图像
这是我使用的代码:
<UserControl x:Class="PROShine.TeamView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PROShine"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<SolidColorBrush x:Key="NormalBorderBrush" Color="#FF111111" />
<SolidColorBrush x:Key="HeaderBackgroundColor" Color="#FF111111" />
<SolidColorBrush x:Key="HeaderBorderBrush" Color="#FF1e1e1e" />
<SolidColorBrush x:Key="NormalBrush" Color="#FF111111" />
<SolidColorBrush x:Key="PressedBrush" Color="#FF1e1e1e" />
<SolidColorBrush x:Key="SeperatorBrush" Color="#FF1e1e1e" />
<SolidColorBrush x:Key="ForegroundDefault" Color="White" />
<SolidColorBrush x:Key="SolidBorderBrush" Color="#FF111111" />
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FF0d0d0d" />
<Style x:Key="GridViewColumnHeaderGripper" TargetType="Thumb">
<Setter Property="Width" Value="18"/>
<Setter Property="Background" Value="{StaticResource SeperatorBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border Padding="{TemplateBinding Padding}" Background="Transparent">
<Rectangle HorizontalAlignment="Center" Width="1" Fill="{TemplateBinding Background}"/> …Run Code Online (Sandbox Code Playgroud) 我一直在我的 Xamarin.ios 和 Xamarin.Android 项目中使用 OxyPlot 来绘制柱状图。这就是我使用 oxyplot 绘制柱状图的方式。
现在我需要一个堆积柱形图。我在文档中找不到它。oxyplot 有可能吗?如何?任何帮助表示赞赏..
public class MeasurementGraph
{
public PlotModel VitalModel { get; set; }
public VitalGraph graph { get; set; }
public MeasurementGraph (VitalGraph graph)
{
this.graph = graph;
var model = new PlotModel { Title = "" };
model.PlotAreaBorderColor = OxyColors.Transparent;
model.Axes.Add (GetXAxis ());
model.Axes.Add (GetYAxis ());
model.Series.Add (GetValueSeries ());
if (Math.Abs (graph.trendStart) > float.Epsilon && Math.Abs (graph.trendEnd) > float.Epsilon)
model.Series.Add (GetXtraSeries ());
VitalModel = model;
}
CategoryAxis GetXAxis ()
{ …Run Code Online (Sandbox Code Playgroud) 您好,我有一个很大的数据库,我从那里取了1500个值以便在图表中显示。
我的问题是显示所有点需要很长时间,我认为是因为动画设置。
如何更改动画的速度,或者有什么方法可以更快地显示点?
<UserControl x:Class="Ipte.UI.Pages.StatisticsPage"
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"
xmlns:gcl="clr-namespace:GuiControlLibrary;assembly=GuiControlLibrary"
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:time="clr-namespace:Ipte.UI"
xmlns:chartToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
mc:Ignorable="d"
Height="800" Width="1200">
<UserControl.Resources>
<Style x:Key="Scater" TargetType="chartToolkit:ScatterDataPoint">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chartToolkit:ScatterDataPoint">
<Viewbox x:Name="viewbox">
<!--<Ellipse Width="1" Height="1" Fill="Black"/>-->
</Viewbox>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="4"/>
<Setter Property="Height" Value="4"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid x:Name="filterGrid" Grid.Column="0" Margin="4">
<StackPanel>
<TextBlock Text="" Margin="2"/>
<toolkit:DatePicker x:Name="dpStartDate" Margin="2" />
<time:TimePicker x:Name="tpStartTime" Margin="2"/>
<TextBlock Text="End date & time:" Margin="2"/>
<toolkit:DatePicker x:Name="dpEndDate" Margin="2"/>
<time:TimePicker x:Name="tpEndTime" Margin="2"/>
<gcl:GuiGroupBox Header="Select router" …Run Code Online (Sandbox Code Playgroud) 如何才能做到这一点?我已经能够使用xaml来实现它,就像这样。我将如何使用ViewModel模式来做到这一点?
View.xaml
<Button Margin="50,0,20,20" FontSize="Large" Text="Test" Clicked="Button_Clicked">
</Button>
Run Code Online (Sandbox Code Playgroud)
View.cs
private void Button_Clicked(object sender, EventArgs e)
{
Get_LessonViewAsync();
}
private async void Get_LessonViewAsync()
{
var view = new LessonView();
await Navigation.PushModalAsync(view);
}
Run Code Online (Sandbox Code Playgroud) 我在Windows 7旗舰版的新笔记本电脑上使用Visual Studio 2013,C#,Windows Forms应用程序.
从VS内部,如果我构建并运行我的应用程序,它打开正常(没有错误或警告).如果进入调试文件夹并双击exe文件,则该应用程序无法打开.它出现在任务管理器中,但我无法杀死它.我没有收到任何错误消息.因为它正在运行,所以当文件正在使用时,我无法再从VS构建或运行项目.
我尝试了Building to Release并遇到了同样的问题.
摆脱任务管理器的唯一方法是重启笔记本电脑.
这在我的旧PC上也不是问题 - 它也有Win7 Ultimate和VS2013.
你知道为什么我的exe没有运行,为什么我不能在任务管理器中杀死它?任何帮助,将不胜感激.
所以我正在解决泰勒系列,它在这里:

这是代码:
#define _CRT_SECURE_NO_WARNINGS
#include<conio.h>
#include<stdio.h>
#include<math.h>
long double Fact(long double h) {
if (h <= 0) return 1;
else return h*Fact(h - 1);
}
void main(void) {
int p = 0;
long double s = 0, k = 0, c = 0, l = 0,d=0;
int n = 0, x = 0;
printf(" n ");
scanf("%d", &n);
printf(" x ");
scanf("%d", &x);
d = x;
while (n>=0) {
k = pow(-1, n);
c = (2 * n + 1); …Run Code Online (Sandbox Code Playgroud) c# ×9
xaml ×4
wpf ×3
charts ×2
oxyplot ×2
animation ×1
arrays ×1
asp.net-mvc ×1
c ×1
codeigniter ×1
data-binding ×1
generics ×1
linq ×1
listview ×1
math ×1
mysql ×1
php ×1
propertygrid ×1
winforms ×1
wpftoolkit ×1
xamarin ×1
xceed ×1