與DataGridColumn.Visibility匹配的模式

[英]F# pattern matching with DataGridColumn.Visibility


I'm encountering a situation where I'm using pattern matching for determining the visibility property of a column. System.Windows.Visibility has two fields, Visibility.Visible and Visibility.Collapsed. Can enyone tell me why the following code:

我遇到了一種情況,我使用模式匹配來確定列的可見性。System.Windows。可見性有兩個領域,可見性。可見,Visibility.Collapsed。能告訴我為什么下面的代碼:

let colItem = myDataGrid.Columns.Item 1
     chkBox.IsChecked <-
          match colItem.Visibility with
               | Visibility.Visible -> new Nullable<bool>(true)
               | Visibility.Collapsed -> new Nullable<bool>(false)

generates the follwing warning:

生成下面警告:

Incomplete pattern matches on this expression. For example, the value '2uy' may indicate a case not covered by the pattern(s).

不完整的模式匹配這個表達式。例如,值“2uy”可能表示模式沒有涵蓋的情況。

1 个解决方案

#1


7  

In theory a value of type Visibility can be something other than Visible or Collapsed because .net enums allow any value of the underlying integral type as a value for the enum type (to allow things like ORing enums).

理論上,類型可見性的值可以是不可見或折疊的,因為.net enums允許底層的整型類型的任何值作為enum類型的值(允許使用像ORing enums這樣的值)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/06/03/720f28b5679cb828f746b4aaa1d3f80a.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com