Popup doesn't bind to Toggle when inside DataGrid (xceed)
up vote
1
down vote
favorite
I've made a Toggle, which expands a Popup window with a ListBox inside. It looks like so:
<ToggleButton Name="Toggle" Height="20" Width="150" >
<StackPanel>
<TextBlock Text="TestListPopup"/>
<Popup Height="200" Width="150"
IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
PlacementTarget="{Binding ElementName=Toggle}"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
<ListBox SelectionMode="Multiple" SelectionChanged="TypeSelectionChanged" >
<ListBoxItem Content="Test1"/>
<ListBoxItem Content="Test2"/>
<ListBoxItem Content="Test3"/>
</ListBox>
</Popup>
</StackPanel>
</ToggleButton>
It works perfectly, but I want to use it inside the FilterRow of my xceed DataGrid here:
<xcdg:DataGridControl x:Name="dataGrid"
ItemsSource="{Binding Source={StaticResource DataSource}}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView>
<xcdg:TableflowView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow/>
</DataTemplate>
<DataTemplate>
<xcdg:FilterRow>
<xcdg:FilterCell FieldName="Name" IsEnabled="True"/>
<xcdg:FilterCell FieldName="Type" IsEnabled="True">
<!-- TestListPopup control here -->
</xcdg:FilterCell>
</xcdg:FilterRow>
</DataTemplate>
</xcdg:TableflowView.FixedHeaders>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" Title="Name" />
<xcdg:Column FieldName="Type" Title="Type" Width="160"/>
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
In here though, the popup will not bind to the toggle button. Pressing the toggle button doesn't do anything.
I narrowed it down to the binding being broken, because if you set IsOpen="True", it's open (and not adhering to PlacementTarget), but again; it works perfectly outside of the DataGrid..
Why does a perfectly functional control break once put inside the FilterRow?
Any help is appreciated! :)
wpf listbox popup toggle xceed
add a comment |
up vote
1
down vote
favorite
I've made a Toggle, which expands a Popup window with a ListBox inside. It looks like so:
<ToggleButton Name="Toggle" Height="20" Width="150" >
<StackPanel>
<TextBlock Text="TestListPopup"/>
<Popup Height="200" Width="150"
IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
PlacementTarget="{Binding ElementName=Toggle}"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
<ListBox SelectionMode="Multiple" SelectionChanged="TypeSelectionChanged" >
<ListBoxItem Content="Test1"/>
<ListBoxItem Content="Test2"/>
<ListBoxItem Content="Test3"/>
</ListBox>
</Popup>
</StackPanel>
</ToggleButton>
It works perfectly, but I want to use it inside the FilterRow of my xceed DataGrid here:
<xcdg:DataGridControl x:Name="dataGrid"
ItemsSource="{Binding Source={StaticResource DataSource}}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView>
<xcdg:TableflowView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow/>
</DataTemplate>
<DataTemplate>
<xcdg:FilterRow>
<xcdg:FilterCell FieldName="Name" IsEnabled="True"/>
<xcdg:FilterCell FieldName="Type" IsEnabled="True">
<!-- TestListPopup control here -->
</xcdg:FilterCell>
</xcdg:FilterRow>
</DataTemplate>
</xcdg:TableflowView.FixedHeaders>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" Title="Name" />
<xcdg:Column FieldName="Type" Title="Type" Width="160"/>
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
In here though, the popup will not bind to the toggle button. Pressing the toggle button doesn't do anything.
I narrowed it down to the binding being broken, because if you set IsOpen="True", it's open (and not adhering to PlacementTarget), but again; it works perfectly outside of the DataGrid..
Why does a perfectly functional control break once put inside the FilterRow?
Any help is appreciated! :)
wpf listbox popup toggle xceed
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've made a Toggle, which expands a Popup window with a ListBox inside. It looks like so:
<ToggleButton Name="Toggle" Height="20" Width="150" >
<StackPanel>
<TextBlock Text="TestListPopup"/>
<Popup Height="200" Width="150"
IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
PlacementTarget="{Binding ElementName=Toggle}"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
<ListBox SelectionMode="Multiple" SelectionChanged="TypeSelectionChanged" >
<ListBoxItem Content="Test1"/>
<ListBoxItem Content="Test2"/>
<ListBoxItem Content="Test3"/>
</ListBox>
</Popup>
</StackPanel>
</ToggleButton>
It works perfectly, but I want to use it inside the FilterRow of my xceed DataGrid here:
<xcdg:DataGridControl x:Name="dataGrid"
ItemsSource="{Binding Source={StaticResource DataSource}}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView>
<xcdg:TableflowView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow/>
</DataTemplate>
<DataTemplate>
<xcdg:FilterRow>
<xcdg:FilterCell FieldName="Name" IsEnabled="True"/>
<xcdg:FilterCell FieldName="Type" IsEnabled="True">
<!-- TestListPopup control here -->
</xcdg:FilterCell>
</xcdg:FilterRow>
</DataTemplate>
</xcdg:TableflowView.FixedHeaders>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" Title="Name" />
<xcdg:Column FieldName="Type" Title="Type" Width="160"/>
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
In here though, the popup will not bind to the toggle button. Pressing the toggle button doesn't do anything.
I narrowed it down to the binding being broken, because if you set IsOpen="True", it's open (and not adhering to PlacementTarget), but again; it works perfectly outside of the DataGrid..
Why does a perfectly functional control break once put inside the FilterRow?
Any help is appreciated! :)
wpf listbox popup toggle xceed
I've made a Toggle, which expands a Popup window with a ListBox inside. It looks like so:
<ToggleButton Name="Toggle" Height="20" Width="150" >
<StackPanel>
<TextBlock Text="TestListPopup"/>
<Popup Height="200" Width="150"
IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
PlacementTarget="{Binding ElementName=Toggle}"
HorizontalAlignment="Left"
VerticalAlignment="Bottom">
<ListBox SelectionMode="Multiple" SelectionChanged="TypeSelectionChanged" >
<ListBoxItem Content="Test1"/>
<ListBoxItem Content="Test2"/>
<ListBoxItem Content="Test3"/>
</ListBox>
</Popup>
</StackPanel>
</ToggleButton>
It works perfectly, but I want to use it inside the FilterRow of my xceed DataGrid here:
<xcdg:DataGridControl x:Name="dataGrid"
ItemsSource="{Binding Source={StaticResource DataSource}}">
<xcdg:DataGridControl.View>
<xcdg:TableflowView>
<xcdg:TableflowView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow/>
</DataTemplate>
<DataTemplate>
<xcdg:FilterRow>
<xcdg:FilterCell FieldName="Name" IsEnabled="True"/>
<xcdg:FilterCell FieldName="Type" IsEnabled="True">
<!-- TestListPopup control here -->
</xcdg:FilterCell>
</xcdg:FilterRow>
</DataTemplate>
</xcdg:TableflowView.FixedHeaders>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" Title="Name" />
<xcdg:Column FieldName="Type" Title="Type" Width="160"/>
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
In here though, the popup will not bind to the toggle button. Pressing the toggle button doesn't do anything.
I narrowed it down to the binding being broken, because if you set IsOpen="True", it's open (and not adhering to PlacementTarget), but again; it works perfectly outside of the DataGrid..
Why does a perfectly functional control break once put inside the FilterRow?
Any help is appreciated! :)
wpf listbox popup toggle xceed
wpf listbox popup toggle xceed
edited Nov 8 at 13:18
mm8
79.1k81731
79.1k81731
asked Nov 8 at 11:21
Hjalte Tagmose
4518
4518
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Why does a perfectly functional control break once put inside the
FilterRow?
Because the ToggleButton and the FilterCell don't belong to the same namescope.
You may try to bind using an x:Reference:
IsOpen="{Binding Path=IsChecked, Source={x:Reference Toggle}}"
The other option would be to bind the IsChecked property of the ToggleButton to a bool property of a view model and also bind the IsOpen property of the Popup to the same source property. Make sure that the view model implements the INotifyPropertyChanged interface and raise change notifications when the source property is set.
Thank you! I knew there had to be a reasonable explanation. However thex:Referencesolution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)
– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannotx:Referenceits parent, so I just put the Popup beside the Toggle instead of inside it!
– Hjalte Tagmose
Nov 8 at 13:21
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Why does a perfectly functional control break once put inside the
FilterRow?
Because the ToggleButton and the FilterCell don't belong to the same namescope.
You may try to bind using an x:Reference:
IsOpen="{Binding Path=IsChecked, Source={x:Reference Toggle}}"
The other option would be to bind the IsChecked property of the ToggleButton to a bool property of a view model and also bind the IsOpen property of the Popup to the same source property. Make sure that the view model implements the INotifyPropertyChanged interface and raise change notifications when the source property is set.
Thank you! I knew there had to be a reasonable explanation. However thex:Referencesolution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)
– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannotx:Referenceits parent, so I just put the Popup beside the Toggle instead of inside it!
– Hjalte Tagmose
Nov 8 at 13:21
add a comment |
up vote
1
down vote
accepted
Why does a perfectly functional control break once put inside the
FilterRow?
Because the ToggleButton and the FilterCell don't belong to the same namescope.
You may try to bind using an x:Reference:
IsOpen="{Binding Path=IsChecked, Source={x:Reference Toggle}}"
The other option would be to bind the IsChecked property of the ToggleButton to a bool property of a view model and also bind the IsOpen property of the Popup to the same source property. Make sure that the view model implements the INotifyPropertyChanged interface and raise change notifications when the source property is set.
Thank you! I knew there had to be a reasonable explanation. However thex:Referencesolution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)
– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannotx:Referenceits parent, so I just put the Popup beside the Toggle instead of inside it!
– Hjalte Tagmose
Nov 8 at 13:21
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Why does a perfectly functional control break once put inside the
FilterRow?
Because the ToggleButton and the FilterCell don't belong to the same namescope.
You may try to bind using an x:Reference:
IsOpen="{Binding Path=IsChecked, Source={x:Reference Toggle}}"
The other option would be to bind the IsChecked property of the ToggleButton to a bool property of a view model and also bind the IsOpen property of the Popup to the same source property. Make sure that the view model implements the INotifyPropertyChanged interface and raise change notifications when the source property is set.
Why does a perfectly functional control break once put inside the
FilterRow?
Because the ToggleButton and the FilterCell don't belong to the same namescope.
You may try to bind using an x:Reference:
IsOpen="{Binding Path=IsChecked, Source={x:Reference Toggle}}"
The other option would be to bind the IsChecked property of the ToggleButton to a bool property of a view model and also bind the IsOpen property of the Popup to the same source property. Make sure that the view model implements the INotifyPropertyChanged interface and raise change notifications when the source property is set.
answered Nov 8 at 12:50
mm8
79.1k81731
79.1k81731
Thank you! I knew there had to be a reasonable explanation. However thex:Referencesolution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)
– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannotx:Referenceits parent, so I just put the Popup beside the Toggle instead of inside it!
– Hjalte Tagmose
Nov 8 at 13:21
add a comment |
Thank you! I knew there had to be a reasonable explanation. However thex:Referencesolution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)
– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannotx:Referenceits parent, so I just put the Popup beside the Toggle instead of inside it!
– Hjalte Tagmose
Nov 8 at 13:21
Thank you! I knew there had to be a reasonable explanation. However the
x:Reference solution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)– Hjalte Tagmose
Nov 8 at 13:14
Thank you! I knew there had to be a reasonable explanation. However the
x:Reference solution puts the app into breakmode, with following error Cannot call MarkupExtension.ProvideValue because of a cyclical dependency. Properties inside a MarkupExtension cannot reference objects that reference the result of the MarkupExtension. The other solution isn't really gonna work for me either, because I might want multiple controls pr grid/view and I dont want a bunch of IsOpenX-vars. All that said you definitely gave me a big push in the right direction so thank you! :)– Hjalte Tagmose
Nov 8 at 13:14
Okay I found out what was happening. Apparently a child cannot
x:Reference its parent, so I just put the Popup beside the Toggle instead of inside it!– Hjalte Tagmose
Nov 8 at 13:21
Okay I found out what was happening. Apparently a child cannot
x:Reference its parent, so I just put the Popup beside the Toggle instead of inside it!– Hjalte Tagmose
Nov 8 at 13:21
add a comment |
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
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206739%2fpopup-doesnt-bind-to-toggle-when-inside-datagrid-xceed%23new-answer', 'question_page');
}
);
Post as a guest
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
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
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