小编use*_*657的帖子

WPF密钥是数字或数字

previewKeyDown在窗口中有方法,我想知道按下的键只有A-Z字母或1-0数字(没有anyF1..12,输入,ctrl,alt等 - 只是字母或数字).

我试过了Char.IsLetter,但我需要给char,所以e.key.ToString()[0]不起作用,因为它几乎每次都是一封信.

c# wpf key keydown

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

MouseDown在Grid中不起作用(仅在网格中的按钮上)

我有MouseDown事件的问题.我的应用程序看起来像这样,我有网格,其中我在代码后面添加按钮

<Grid Grid.Column="1" Name="gridWithButtons" MouseDown="normalModeButtonsWP_MouseDown" >
        <WrapPanel Name="normalModeButtonsWP" MouseDown="normalModeButtonsWP_MouseDown" ></WrapPanel>
</Grid>
Run Code Online (Sandbox Code Playgroud)

但是当我在网格/ wrappanel中按下鼠标按钮时(我的意思是在按钮之间的空白区域)它不起作用.仅当我按下包裹/网格中的按钮时才有效.有谁知道如何处理它?

wpf grid wrappanel mousedown

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

在整个应用程序中捕获按键

有可能,捕获(我想在app.xaml.cs的某个地方)任何键,如果按下打开的窗口?

感谢帮助!

c# wpf keypress

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

使用Selected DataTemplate在ListView中选择对象

我在ListView上使用DataTemplate for SelectedItem:

<ControlTemplate x:Key="SelectedTemplate" TargetType="ListViewItem">
<WrapPanel (...) BackGround="Silver">

</WrapPanel>
(...)
<Style TargetType="ListViewItem">
       <Style.Triggers>
             <MultiTrigger>
                   <MultiTrigger.Conditions>
                       <Condition Property="IsSelected" Value="true" />
                       <Condition Property="Selector.IsSelectionActive" Value="true" />
                   </MultiTrigger.Conditions>
                   <Setter Property="Template" Value="{StaticResource SelectedTemplate}" />
             </MultiTrigger>
       </Style.Triggers>
</Style>
</ControlTemplate>
Run Code Online (Sandbox Code Playgroud)

此外,ItemsSource绑定到IObservableCollection.但是我在myListView中选择项目时遇到了一些问题.我想要达到的是,默认项目模板具有白色背景.选定的背景是银.当我点击项目时,背景会发生变化.但是当我从代码中执行此操作时,listview已选择项目(选中,选中index = 0,selectetitem!= null),但项目从非选定项目获取样式.所以基本上我想用selectedTemplate选择项目.我已经尝试了myListView.SelectedIndex,myLisview.SelectedItem,但实际上并没有工作..有什么想法吗?

谢谢!

c# wpf listview datatemplate selected

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

从SQL中选择多行到子查询中的一行

我有这样的查询:

DECLARE @razem VARCHAR(MAX);

SELECT  Ordering.orderID , 
        Document.number, 
        (User_info.name  +' '+ User_info.surname),   
        Ordering.dateStart, 
        Ordering.dateEnd ,   
        (
            select   COALESCE(' ',@razem)+sell_type.name as r  
            from    Ordering_sell_type, Sell_type 
            where   orderID = Ordering.orderID and 
                    Ordering_sell_type.sell_typeID = sell_type.sell_typeID
        ) podz
FROM    Ordering, User_info, Product_Document, Document, Document_type   
WHERE   Ordering.orderID = Product_document.orderID  
        AND Document.documentID = Document_type.documentID  
        AND Document.documentID = Product_document.documentID  
        AND  Ordering.userID = User_info.userID   
        AND Ordering.isClosed = 1 AND Document_type.typeID = 1   
GROUP   BY  Document.isitfiscal, Document.refDocID, 
            Document.number, Ordering.orderID, User_info.name, 
            User_info.surname, Ordering.dateStart, 
            Ordering.dateEnd , Ordering.isCLosed  
ORDER   BY Ordering.dateEnd
Run Code Online (Sandbox Code Playgroud)

在COALESCE函数中,我想获得所选订单的所有付款类型 …

sql sql-server coalesce

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