开发者

F# pattern matching with DataGridColumn.Visibility

开发者 https://www.devze.com 2023-01-02 08:59 出处:网络
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

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:

let colItem = myDataGrid.Columns.Item 1
     chkBox.IsChecked <-
          match colItem.Visibility with
               | Visibility.Visible -> new Nullable<bool>(true)
               | Visibility.Coll开发者_JAVA技巧apsed -> 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).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消