我有一堆数据点,我想双向绑定到画布上的点.
这些点假设较大的y值像大多数数学图一样反映在向上的方向上.
如何将画布的x,y原点更改为左下角并反转它对y坐标的解释?
(我想留在XAML)
我正在努力探索LINQ,并得出结论,搜索几十个例子,直到我找到一个接近我自己在C#中的应用程序,并没有教我如何钓鱼.
所以回到我立即打砖墙的文档.
有人可以帮我解密一下在msdn http://msdn.microsoft.com/en-us/library/bb548891.aspx上提供的Enumerable.Select方法, 并作为Intellisense的提示给出?
Enumerable.Select(TSource,TResult)方法(IEnumerable(TSource>),Func(TSource,TResult))
如果有助于参考,这是与行号分解的同一行:
我的下面的C#代码显然是一个hack,那么如何捕获Where方法中的索引值?
string[] IntArray = { "a", "b", "c", "b", "b"};
int index=0;
var query = IntArray.Where((s,i) => (s=="b")&((index=i)==i));
//"&" and "==i" only exists to return a bool after the assignment ofindex
foreach (string s in query)
{
Console.WriteLine("{0} is the original index of {1}", index, s);
}
//outputs...
//1 is the original index of b
//3 is the original index of b
//4 is the original index of b
Run Code Online (Sandbox Code Playgroud) 说我有一个字符串数组:
string[] strArray = {"aa", "bb", "xx", "cc", "xx", "dd", "ee", "ff", "xx","xx","gg","xx"};
Run Code Online (Sandbox Code Playgroud)
如何使用LINQ将"xx"标记之间的字符串作为组提取?
通过将它们写入控制台说:
cc
dd,ee,ff
gg
Run Code Online (Sandbox Code Playgroud) 我正在自学C#,OOP和WPF,因此填充的可能性是惊人的.
因此,有人可以解释为什么在我的小测试示例中单击按钮后,Name属性出现在TextBox中,但ListBox没有显示任何内容?
<Window x:Class="BindingTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BindingTest" Height="250" Width="300">
<Grid Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Button
Grid.Row="0"
Name="MakeIntListButton"
Click="MakeIntListButton_Click">Make and Display Integer List</Button>
<TextBox Grid.Row="1" Text ="{Binding Path=Name}"
/>
<ListBox
Grid.Row="2"
ItemsSource="{Binding Path=MyIntegers}"
/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BindingTest
{
/// <summary>
/// Interaction logic for Window1.xaml …Run Code Online (Sandbox Code Playgroud)