Unable to cast type isse in silverlight
- by prince23
error
once i clcik on the button i am getting this error.
this is my code
<sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected">
<sdk:DataGrid.Columns>
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="+" Click="Button_Click"></Button>
</DataTemplate>
private void Button_Click(object sender, RoutedEventArgs e)
{
Button btnExpandCollapse = sender as Button;
var Row = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
if (Row.DetailsVisibility == Visibility.Collapsed)
{
Row.DetailsVisibility = Visibility.Visible;
}
else
{
Row.DetailsVisibility = Visibility.Collapsed;
}
if (btnExpandCollapse.Content.ToString() == "+")
{
btnExpandCollapse.Content = "-";
}
else if (btnExpandCollapse.Content.ToString() == "-")
{
btnExpandCollapse.Content = "+";
}
}
void dtg_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e)
{
DataGrid RowDetails = e.DetailsElement as DataGrid
if(RowDetails.YourDesiciveFlag = true)
{
}
else
{
}
}
}
working on this issue from past 3 days
any idea how to solve this issue. just going mad on this issue.
for expand /collpase in data grid in silverlight.
let me know if you people can provide me any code that can solve my issue.
thanks in advance
prince