Ejemplo n.º 1
0
        void OnTooltipShow(object sender, ToolTipShowingEventArgs e)
        {
            var item = ContentView.GetItem(e.RowIndex);

            if (item == null)
            {
                return;
            }

            var rowObject = item.RowObject;

            if (rowObject == null)
            {
                return;
            }

            var columnHeader = ContentView.GetColumn(e.ColumnIndex);

            if (columnHeader == null)
            {
                return;
            }

            var cellInfo = rowObject.GetType().GetField(columnHeader.AspectName);

            if (cellInfo == null)
            {
                throw new Exception(String.Format(@"Unexpected exception that should not happen: Type {0} does not contain a field named {1}.", rowObject.GetType(), columnHeader.AspectName));
            }

            if (cellInfo.FieldType == typeof(string))
            {
                e.Text = cellInfo.GetValue(rowObject) as string;
            }
            else if (cellInfo.GetCustomAttribute(typeof(StoragePresenceAttribute), false) != null)
            {
                var items = ((Array)cellInfo.GetValue(rowObject)).Cast <object>().ToArray();
                e.Text = @"[ " + String.Join(", ", items) + @" ]";
            }
        }
Ejemplo n.º 2
0
 protected string GetUnderlyingObjectText(ToolTipShowingEventArgs e)
 {
     return(GetUnderlyingObjectText(ContentView.GetItem(e.RowIndex).RowObject, ContentView.GetColumn(e.ColumnIndex)));
 }