【发布时间】:2015-08-29 09:28:42
【问题描述】:
我有一个包含 2 列的列表视图:系统的“可见性”和“名称”。第 1 列的值:带有图像 (img_visibility) 的按钮 (btn_visibility)。
取决于图像背后代码中对象的布尔值(真或假)应该改变,例如SYSTEM.SHOW_IN_LIST = 真; img_visibility.Source = new BitmapImage(new Uri(App.CONTROLLER.PATHS.PATH_TO_MINUS));
可以通过以下相对路径访问图像:App.CONTROLLER.PATHS.PATH_TO_"我的图像名称",例如App.CONTROLLER.PATHS.PATH_TO_ADD;
我在 SystemmanagementWindow.xaml 中的 xaml 代码:
<ListView x:Name="lv_Systems" HorizontalAlignment="Left" Height="227" Margin="313,5,0,0" VerticalAlignment="Top" Width="153" SelectedIndex="0" SelectionChanged="listView_Systems_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="{x:Static p:Resources.SystemmanagementWindow_listView_col_1}" DisplayMemberBinding="{Binding SYSTEMNAME}" Width="110"/>
<GridViewColumn Header="{x:Static p:Resources.SystemmanagementWindow_listView_col_2}" Width="34">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Click="EditVisibility" CommandParameter="{Binding}" Width="20">
<Image x:Name="img_visibility" width="10" Height="10"/>
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
非常感谢!
【问题讨论】:
标签: c# wpf xaml listview boolean