style that I have to create in code-behind. It has a checkbox that looks like this..
<GridView>
<GridViewColumn Width="30">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<CheckBox/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>-->
<GridViewColumn Header="Groups" DisplayMemberBinding="{Binding Groups}"/>
<GridViewColumn Header="SiteTitle" DisplayMemberBinding="{Binding SiteTitle}"/>
<GridViewColumn Header="SiteUrl" DisplayMemberBinding="{Binding SiteUrl}"/>
</GridView>
How I do in code-behind?
Just add this style in Resources
and give it a x:Name
.Let's assume the given name is CustomCheckboxTemplate
, then a sample code will look like :
DynamicallyCreatedCheckbox.Style = (Style)FindResource("CustomCheckboxTemplate");
Hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With