The application is written for a windows 8 tablet desktop. I have applied the windows 8 touch theme in the code behind of my main window.
StyleManager.ApplicationTheme=
new
Windows8TouchTheme();
Started with a GridViewToggleRowDetailsColumn to open the detail of a row. Unfortunaltely the arrow is too small for the tablet and therefore the touch registration for the arrow would be very finicky.
Decided to create a custom gridview column that mimicked the behavior of the GridViewToggleRowDetailsColumn as authored in these forums many times.
public
class
InoToggleColumn: GridViewBoundColumnBase
{
public
override
object
Header
{
get
{
return
null
;
}
set
{
base
.Header = value;
}
}
public
InoToggleColumn()
{
EditTriggers = GridViewEditTriggers.None;
}
public
override
System.Windows.FrameworkElement CreateCellElement(GridViewCell cell,
object
dataItem)
{
var gvt =
new
RadToggleButton()
{ Margin =
new
System.Windows.Thickness(3) };
gvt.SetBinding(RadToggleButton.IsCheckedProperty, DataMemberBinding);
gvt.Checked += (sender, e) => _setImage((RadToggleButton)sender);
gvt.Unchecked += (sender, e) => _setImage((RadToggleButton)sender);
_setImage(gvt);
var row = cell.ParentRow
as
GridViewRow;
if
(row !=
null
)
{
row.SetBinding(GridViewRow.DetailsVisibilityProperty,
new
Binding(
"IsChecked"
)
{
Source = gvt, Converter =
new
BooleanToVisibilityConverter(), Mode = BindingMode.TwoWay
});
}
return
gvt;
}
private
void
_setImage(RadToggleButton radToggleButton)
{
Image sourceImage;
if
(radToggleButton==
null
)
return
;
if
(radToggleButton.IsChecked ==
null
)
return
;
if
(radToggleButton.IsChecked.Value)
{
sourceImage =
new
Image()
{
Source =
new
BitmapImage(
new
Uri(@
"/InoAuto;component/Assets/Images/arrow-down.png"
,
UriKind.Relative)),Width = 40
};
}
else
{
sourceImage =
new
Image()
{
Source =
new
BitmapImage(
new
Uri(@
"/InoAuto;component/Assets/Images/arrow-right.png"
,
UriKind.Relative)),Width = 40
};
}
radToggleButton.Content = sourceImage;
}
public
override
bool
CanSort()
{
return
false
;
}
public
override
bool
CanFilter()
{
return
false
;
}
public
override
bool
CanGroup()
{
return
false
;
}
}
It works fine with a mouse but when I move it to my windows 8 surface tablet.
The Touchs do not register, the button does not toggle , and the detail is not displayed.
Any assistance would be appreciated
thanks
dco