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! :)










share|improve this question




























    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! :)










    share|improve this question


























      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! :)










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 13:18









      mm8

      79.1k81731




      79.1k81731










      asked Nov 8 at 11:21









      Hjalte Tagmose

      4518




      4518
























          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.






          share|improve this answer





















          • 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











          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',
          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
          });


          }
          });














           

          draft saved


          draft discarded


















          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
































          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.






          share|improve this answer





















          • 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















          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.






          share|improve this answer





















          • 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













          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 8 at 12:50









          mm8

          79.1k81731




          79.1k81731












          • 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


















          • 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
















          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


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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




















































































          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)