-
I have asked about this on the Discord too, but didn't get any response so now i am trying here. As far as i can tell i have setup my
private ListView BuildNavigationListView(ModulesNavigationViewModel viewModel)
{
var listView = new ListView();
listView.Region(true);
var listOptions = Modules.Select(module =>
{
var block = new TextBlock()
{
Text = module.GetModuleAsReadableString(),
Margin = new Thickness(10, 0, 0, 0),
};
block.Region(name: module.GetModuleAsReadableString());
return block;
});
listView.ItemsSource = listOptions;
return listView;
}
private Grid BuildContentGrid(ModulesNavigationViewModel viewModel)
{
var grid = new Grid
{
Background = new SolidColorBrush(Colors.AliceBlue),
};
grid.Region(attached: true, navigator: "Visibility");
foreach (TrackerModule module in Modules)
{
var contentGrid = new Grid
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Visibility = Visibility.Collapsed,
};
contentGrid.Region(name: module.GetModuleAsReadableString());
contentGrid.Children.Add(module.GetModuleControl());
grid.Children.Add(contentGrid);
}
return grid;
} (Full file Here) For some reason it doesn't work, and i can't figure out why. When clicking my menu options, the visibility of the regions with the matching name are not changed. I am developing for only WebAssembly, and have checked with F12 - the div's that should change visibility does not. When changing the visibility of the content grid manually to visible, then it displays correctly. I suspect it is caused by the string supplied to the I have also tried to add the Don't fully understand, yet, if the region name needs to be defined during the Any help would be highly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey @andr9528, Were you able to resolve the issue since posting? One option is to use the "Code-behind" method, which you can follow here. However, if you want to use UI navigation ("Navigate in XAML") with Navigation.SetRequest(listView, "Second");
Navigation.SetData(listView, /*Some control to display*/ null); Here, "Second" represents the name of the page you want to navigate to (which must be a registered route), and you can display some control/data by passing it with Let me know, if this helps. I can provide a sample, if you need. |
Beta Was this translation helpful? Give feedback.
I got changing of the visibility to work. I'd classicy what i did as a hack. I 'simply' saved the refences to the content grids, and depending the option clicked in my navigation list, the assosiated grid is shown, while hidding the others.
It, sadly, doesn't explain why the region based navigation does not work. But it works for what i want so /shrug/