小编Dav*_*ith的帖子

如何将画布的x,y原点更改为左下角并翻转y坐标?

我有一堆数据点,我想双向绑定到画布上的点.

这些点假设较大的y值像大多数数学图一样反映在向上的方向上.

如何将画布的x,y原点更改为左下角并反转它对y坐标的解释?

(我想留在XAML)

silverlight wpf graphics xaml drawing

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

如何解析MSDN上的Select方法文档?

我正在努力探索LINQ,并得出结论,搜索几十个例子,直到我找到一个接近我自己在C#中的应用程序,并没有教我如何钓鱼.

所以回到我立即打砖墙的文档.

有人可以帮我解密一下在msdn http://msdn.microsoft.com/en-us/library/bb548891.aspx上提供的Enumerable.Select方法, 并作为Intellisense的提示给出?

Enumerable.Select(TSource,TResult)方法(IEnumerable(TSource>),Func(TSource,TResult))

如果有助于参考,这是与行号分解的同一行:

  1. Enumerable.Select
  2. (TSource,TResult)
  3. 方法
  4. (IEnumerable的(TSource>),
  5. FUNC
  6. (TSource,TResult))

.net c# linq

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

有没有办法在C#中的LINQ Where方法中捕获索引值?

我的下面的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)

c# linq

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

使用C#,LINQ如何一次又一次地在标记之间选择项目?

说我有一个字符串数组:

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# linq

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

如何使用DataContext绑定到List <T>?

我正在自学C#,OOP和WPF,因此填充的可能性是惊人的.

因此,有人可以解释为什么在我的小测试示例中单击按钮后,Name属性出现在TextBox中,但ListBox没有显示任何内容?

XAML:

<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)

C#:

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)

.net c# wpf xaml

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

标签 统计

c# ×4

linq ×3

.net ×2

wpf ×2

xaml ×2

drawing ×1

graphics ×1

silverlight ×1