How to bind to Metro Flyout ItemContainerStyle property from button in RightWindowCommands?
up vote
0
down vote
favorite
I'm working off the solution to this question as a basis for my current attempt to manage the opening and closing of a Metro flyout. The difference is that I have a ToggleButton
defined in the RightWindowCommands
. The desired behavior is that the IsChecked
status of this button should be bound to the IsOpen property of the underlying flyout viewmodel.
This is the XAML with some of my failed attempts:
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl x:Name="FlyoutsControl" >
<controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type controls:Flyout}}" TargetType="{x:Type controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</controls:FlyoutsControl.ItemContainerStyle>
<controls:FlyoutsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:SettingsFlyoutViewModel}">
<local:SettingsFlyoutView x:Name="SettingsFlyoutView"/>
</DataTemplate>
</controls:FlyoutsControl.ItemTemplate>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1" IsChecked="{Binding ElementName=SettingsFlyoutView, Path=IsOpen}" Cursor="Hand"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:MetroWindow}}, Path=IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=FlyoutsControl, Path=DataContext.IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:Flyout}}, Path=IsOpen}"/>-->
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
What is the right binding strategy to bind IsChecked to IsOpen?
wpf xaml mvvm mahapps.metro flyout
add a comment |
up vote
0
down vote
favorite
I'm working off the solution to this question as a basis for my current attempt to manage the opening and closing of a Metro flyout. The difference is that I have a ToggleButton
defined in the RightWindowCommands
. The desired behavior is that the IsChecked
status of this button should be bound to the IsOpen property of the underlying flyout viewmodel.
This is the XAML with some of my failed attempts:
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl x:Name="FlyoutsControl" >
<controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type controls:Flyout}}" TargetType="{x:Type controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</controls:FlyoutsControl.ItemContainerStyle>
<controls:FlyoutsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:SettingsFlyoutViewModel}">
<local:SettingsFlyoutView x:Name="SettingsFlyoutView"/>
</DataTemplate>
</controls:FlyoutsControl.ItemTemplate>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1" IsChecked="{Binding ElementName=SettingsFlyoutView, Path=IsOpen}" Cursor="Hand"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:MetroWindow}}, Path=IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=FlyoutsControl, Path=DataContext.IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:Flyout}}, Path=IsOpen}"/>-->
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
What is the right binding strategy to bind IsChecked to IsOpen?
wpf xaml mvvm mahapps.metro flyout
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm working off the solution to this question as a basis for my current attempt to manage the opening and closing of a Metro flyout. The difference is that I have a ToggleButton
defined in the RightWindowCommands
. The desired behavior is that the IsChecked
status of this button should be bound to the IsOpen property of the underlying flyout viewmodel.
This is the XAML with some of my failed attempts:
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl x:Name="FlyoutsControl" >
<controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type controls:Flyout}}" TargetType="{x:Type controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</controls:FlyoutsControl.ItemContainerStyle>
<controls:FlyoutsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:SettingsFlyoutViewModel}">
<local:SettingsFlyoutView x:Name="SettingsFlyoutView"/>
</DataTemplate>
</controls:FlyoutsControl.ItemTemplate>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1" IsChecked="{Binding ElementName=SettingsFlyoutView, Path=IsOpen}" Cursor="Hand"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:MetroWindow}}, Path=IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=FlyoutsControl, Path=DataContext.IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:Flyout}}, Path=IsOpen}"/>-->
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
What is the right binding strategy to bind IsChecked to IsOpen?
wpf xaml mvvm mahapps.metro flyout
I'm working off the solution to this question as a basis for my current attempt to manage the opening and closing of a Metro flyout. The difference is that I have a ToggleButton
defined in the RightWindowCommands
. The desired behavior is that the IsChecked
status of this button should be bound to the IsOpen property of the underlying flyout viewmodel.
This is the XAML with some of my failed attempts:
<controls:MetroWindow.Flyouts>
<controls:FlyoutsControl x:Name="FlyoutsControl" >
<controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type controls:Flyout}}" TargetType="{x:Type controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</controls:FlyoutsControl.ItemContainerStyle>
<controls:FlyoutsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:SettingsFlyoutViewModel}">
<local:SettingsFlyoutView x:Name="SettingsFlyoutView"/>
</DataTemplate>
</controls:FlyoutsControl.ItemTemplate>
</controls:FlyoutsControl>
</controls:MetroWindow.Flyouts>
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1" IsChecked="{Binding ElementName=SettingsFlyoutView, Path=IsOpen}" Cursor="Hand"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:MetroWindow}}, Path=IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=FlyoutsControl, Path=DataContext.IsOpen}"/>-->
<!--<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:Flyout}}, Path=IsOpen}"/>-->
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
What is the right binding strategy to bind IsChecked to IsOpen?
wpf xaml mvvm mahapps.metro flyout
wpf xaml mvvm mahapps.metro flyout
edited Nov 26 at 19:20
asked Nov 21 at 19:01
ket
239112
239112
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22
add a comment |
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Here you go
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
<Controls:Flyout x:Name="yourMahAppFlyout" Header="Flyout" Position="Right" Width="200">
<!-- Your custom content here -->
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
When I add the<Controls:Flyout>
line item, I get a runtime exceptionItems collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?
– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Here you go
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
<Controls:Flyout x:Name="yourMahAppFlyout" Header="Flyout" Position="Right" Width="200">
<!-- Your custom content here -->
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
When I add the<Controls:Flyout>
line item, I get a runtime exceptionItems collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?
– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
add a comment |
up vote
0
down vote
Here you go
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
<Controls:Flyout x:Name="yourMahAppFlyout" Header="Flyout" Position="Right" Width="200">
<!-- Your custom content here -->
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
When I add the<Controls:Flyout>
line item, I get a runtime exceptionItems collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?
– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
add a comment |
up vote
0
down vote
up vote
0
down vote
Here you go
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
<Controls:Flyout x:Name="yourMahAppFlyout" Header="Flyout" Position="Right" Width="200">
<!-- Your custom content here -->
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
Here you go
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:FlyoutsControl.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type Controls:Flyout}}" TargetType="{x:Type Controls:Flyout}">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="IsOpen" Value="{Binding IsOpen}" />
<Setter Property="Position" Value="{Binding Position}" />
<Setter Property="Theme" Value="Accent" />
</Style>
</Controls:FlyoutsControl.ItemContainerStyle>
<Controls:Flyout x:Name="yourMahAppFlyout" Header="Flyout" Position="Right" Width="200">
<!-- Your custom content here -->
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<ToggleButton Content="{iconPacks:FontAwesome Kind=FighterJetSolid}" Background="{DynamicResource AccentColorBrush}" ToolTip="Toggle flyout." BorderBrush="White" BorderThickness="1"
IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
answered Nov 22 at 15:44
RajN
3,3732921
3,3732921
When I add the<Controls:Flyout>
line item, I get a runtime exceptionItems collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?
– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
add a comment |
When I add the<Controls:Flyout>
line item, I get a runtime exceptionItems collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?
– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
When I add the
<Controls:Flyout>
line item, I get a runtime exception Items collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?– ket
Nov 26 at 18:52
When I add the
<Controls:Flyout>
line item, I get a runtime exception Items collection must be empty before using ItemsSource.
One difference between my scenario and the Mahapps website snippet is that their example doesn't use an ItemContainerStyle, which I believe I need for binding to my viewmodel properties based on the link at top. Any thoughts how to resolve the exception?– ket
Nov 26 at 18:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I can't reproduce your issue. Can you post your code sample to look at it?
– RajN
Nov 26 at 20:52
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
I have placed a copy of the project as it throws the exception here: 1drv.ms/f/s!AsvM6Pyke4A6hCRyovosrs0kIKGG, The content above can be found in MainWindow.xaml.
– ket
Nov 27 at 17:04
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53418921%2fhow-to-bind-to-metro-flyout-itemcontainerstyle-property-from-button-in-rightwind%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
How do you identify the "underlying" Flyout for a specific button?
– mm8
Nov 22 at 13:18
@mm8 Good point - I edited my question to include the previously omitted ItemTemplate. Here SettingsFlyoutView is a user control which leverages SettingsFlyoutViewModel as the backing viewmodel. I'm still having difficulty doing the binding tho; see the newest attempt at top of the commented section. What am I missing?
– ket
Nov 26 at 19:22