Enable expander on button condition check wpf datagrid
suppose i have a datagrid in which there is 2 columns and 1 expander in each column.
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsRuleDetailsExpanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Status">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Ellipse Grid.Column="1"
Width="15"
Height="15"
Fill="{Binding Status,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ColorToBrushConverter}}" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Add Rule">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Width="22" Height="22"
ToolTip="Add Rule"
BorderThickness="0"
Background="Transparent"
Style="{StaticResource TransparentStyle}"
IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsMonitorDataGridColumnEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.AddRuleCommand}"
CommandParameter="{Binding ElementName=MonitorDataGrid, Path=SelectedItem}">
<Image Source="/OBDApplication;component/Images/addRule1.png"
Width="17"
Height="17"
ToolTip="Add Rule" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
Now i have to control the visibility of each expander. on click of Add rule button, a new window appears which takes some input and add data to a collection. if there is any data present in a rule then only i should show the expander icon.
so, i have bound a boolean property to control visibility and after a rule is added to collection, i am making that boolean property as true. But the problem is that expander is visible for every row cause boolean returns true even if there is a record in the collection.
so how can i control the visiblity of expander for each row?
c# wpf data-binding wpf-controls wpfdatagrid
add a comment |
suppose i have a datagrid in which there is 2 columns and 1 expander in each column.
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsRuleDetailsExpanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Status">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Ellipse Grid.Column="1"
Width="15"
Height="15"
Fill="{Binding Status,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ColorToBrushConverter}}" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Add Rule">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Width="22" Height="22"
ToolTip="Add Rule"
BorderThickness="0"
Background="Transparent"
Style="{StaticResource TransparentStyle}"
IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsMonitorDataGridColumnEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.AddRuleCommand}"
CommandParameter="{Binding ElementName=MonitorDataGrid, Path=SelectedItem}">
<Image Source="/OBDApplication;component/Images/addRule1.png"
Width="17"
Height="17"
ToolTip="Add Rule" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
Now i have to control the visibility of each expander. on click of Add rule button, a new window appears which takes some input and add data to a collection. if there is any data present in a rule then only i should show the expander icon.
so, i have bound a boolean property to control visibility and after a rule is added to collection, i am making that boolean property as true. But the problem is that expander is visible for every row cause boolean returns true even if there is a record in the collection.
so how can i control the visiblity of expander for each row?
c# wpf data-binding wpf-controls wpfdatagrid
1
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
1
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41
add a comment |
suppose i have a datagrid in which there is 2 columns and 1 expander in each column.
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsRuleDetailsExpanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Status">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Ellipse Grid.Column="1"
Width="15"
Height="15"
Fill="{Binding Status,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ColorToBrushConverter}}" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Add Rule">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Width="22" Height="22"
ToolTip="Add Rule"
BorderThickness="0"
Background="Transparent"
Style="{StaticResource TransparentStyle}"
IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsMonitorDataGridColumnEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.AddRuleCommand}"
CommandParameter="{Binding ElementName=MonitorDataGrid, Path=SelectedItem}">
<Image Source="/OBDApplication;component/Images/addRule1.png"
Width="17"
Height="17"
ToolTip="Add Rule" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
Now i have to control the visibility of each expander. on click of Add rule button, a new window appears which takes some input and add data to a collection. if there is any data present in a rule then only i should show the expander icon.
so, i have bound a boolean property to control visibility and after a rule is added to collection, i am making that boolean property as true. But the problem is that expander is visible for every row cause boolean returns true even if there is a record in the collection.
so how can i control the visiblity of expander for each row?
c# wpf data-binding wpf-controls wpfdatagrid
suppose i have a datagrid in which there is 2 columns and 1 expander in each column.
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsRuleDetailsExpanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Status">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Ellipse Grid.Column="1"
Width="15"
Height="15"
Fill="{Binding Status,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ColorToBrushConverter}}" />
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Add Rule">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Width="22" Height="22"
ToolTip="Add Rule"
BorderThickness="0"
Background="Transparent"
Style="{StaticResource TransparentStyle}"
IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.IsMonitorDataGridColumnEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl},Mode=FindAncestor},Path=DataContext.AddRuleCommand}"
CommandParameter="{Binding ElementName=MonitorDataGrid, Path=SelectedItem}">
<Image Source="/OBDApplication;component/Images/addRule1.png"
Width="17"
Height="17"
ToolTip="Add Rule" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
Now i have to control the visibility of each expander. on click of Add rule button, a new window appears which takes some input and add data to a collection. if there is any data present in a rule then only i should show the expander icon.
so, i have bound a boolean property to control visibility and after a rule is added to collection, i am making that boolean property as true. But the problem is that expander is visible for every row cause boolean returns true even if there is a record in the collection.
so how can i control the visiblity of expander for each row?
c# wpf data-binding wpf-controls wpfdatagrid
c# wpf data-binding wpf-controls wpfdatagrid
asked Nov 19 '18 at 8:32
Ravi SolankiRavi Solanki
5916
5916
1
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
1
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41
add a comment |
1
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
1
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41
1
1
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
1
1
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41
add a comment |
1 Answer
1
active
oldest
votes
I have fixed it with my own.
create a boolean property in the model itself so it will check for each item. And then bind the expander visibility with that model's property.
My updated xaml code for expander looks like this:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding ISMonitorExanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I am still looking for a different approach.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370882%2fenable-expander-on-button-condition-check-wpf-datagrid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have fixed it with my own.
create a boolean property in the model itself so it will check for each item. And then bind the expander visibility with that model's property.
My updated xaml code for expander looks like this:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding ISMonitorExanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I am still looking for a different approach.
add a comment |
I have fixed it with my own.
create a boolean property in the model itself so it will check for each item. And then bind the expander visibility with that model's property.
My updated xaml code for expander looks like this:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding ISMonitorExanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I am still looking for a different approach.
add a comment |
I have fixed it with my own.
create a boolean property in the model itself so it will check for each item. And then bind the expander visibility with that model's property.
My updated xaml code for expander looks like this:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding ISMonitorExanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I am still looking for a different approach.
I have fixed it with my own.
create a boolean property in the model itself so it will check for each item. And then bind the expander visibility with that model's property.
My updated xaml code for expander looks like this:
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander Style="{StaticResource PlusMinusExpanderStyle}"
ToolTip="Rule Details"
Visibility="{Binding ISMonitorExanderVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
>
<Expander.IsExpanded>
<Binding RelativeSource="{RelativeSource AncestorType={x:Type DataGridRow}}"
Path="DetailsVisibility"
Mode="TwoWay">
<Binding.Converter>
<converters:BooleanToVisibilityDataGridRow FalseToVisibility="Collapsed" />
</Binding.Converter>
</Binding>
</Expander.IsExpanded>
</Expander>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I am still looking for a different approach.
answered Nov 19 '18 at 9:01
Ravi SolankiRavi Solanki
5916
5916
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370882%2fenable-expander-on-button-condition-check-wpf-datagrid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Do you bind itemsource to the datagrid or add the rows directly to datagrid? If you have bind itemsource you need to add a new property that specify the visibility, if you add direcly to datagrid you need to find the specific control in the row and make it not visibile.
– Kaspar
Nov 19 '18 at 8:47
Yes, i have fixed it with making a property in the model class then binding it with expander's visiblity instead of viewmodel property.
– Ravi Solanki
Nov 19 '18 at 8:58
1
Second approach could be converter to object, You could bind all object(not only one property) and make converter of visibility based on status of model.
– Kaspar
Nov 19 '18 at 9:11
Thank you @Kaspar :)
– Ravi Solanki
Nov 19 '18 at 9:41