Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter on Silverlight Datagrid using Radio Buttons C#
    primarykey
    data
    text
    <p>I am somewhat new to Silverlight and C#/XAML and i have an issue that i cannot figure out. </p> <p>I have a datagrid:</p> <pre><code>&lt;Grid x:Name="MainDataGrid" Grid.Row="5" &gt; &lt;data:DataGrid x:Name="datagrid" AutoGenerateColumns="False" HorizontalAlignment="Stretch" IsReadOnly="True" VerticalAlignment="Top" ItemsSource="{Binding DataList}" Height="220" Margin="5"&gt; &lt;data:DataGrid.Columns&gt; &lt;data:DataGridTextColumn Header="#" Binding="{Binding Number}" /&gt; &lt;data:DataGridTextColumn Header="Business Process" Width="300" Binding="{Binding BusinessProcess}" /&gt; &lt;data:DataGridTextColumn Header="Sub Process" Width="300" Binding="{Binding SubProcess}" /&gt; &lt;data:DataGridTextColumn Header="ITAC" Width="100" Binding="{Binding Itac}" /&gt; &lt;data:DataGridTextColumn Header="Status" Width="200" Binding="{Binding Status}" /&gt; &lt;/data:DataGrid.Columns&gt; &lt;/data:DataGrid&gt; &lt;/Grid&gt; </code></pre> <p>which is currently bound to some dummy data i created in the ViewModel:</p> <pre><code> public class ItacViewModel : ViewModelBase { public List&lt;data&gt; DataList { get; set; } public ItacViewModel() { var dataList = new List&lt;data&gt; { new data(1, "Fixed Asset", "Depreciation", "UL-AC1", "Under Review"), new data(2, "Fixed Asset", "Depreciation", "UL-AC2", "Complete"), new data(3, "Order to Cash", "Invoicing", "UL-AC3", "Under Review"), new data(4, "Order to Cash", "Shipping Goods", "UL-AC4", "Under Review"), new data(5, "Order to Cash", "Depreciation", "UL-AC5", "Complete"), new data(6, "Order to Cash", "Depreciation", "UL-AC6", "Under Review"), new data(7, "Order to Cash", "Depreciation", "UL-AC7", "Complete"), new data(8, "Stock and Make", "Depreciation", "UL-AC8", "Under Review"), new data(9, "Stock and Make", "Depreciation", "UL-AC9", "Under Review"), new data(10, "General Accounting &amp; Reporting", "Depreciation", "UL-AC10", "Complete") }; DataList = dataList; } } </code></pre> <p>and i wish to be able to filter the data when a Radio Button is selected (The Radio Button names match those in the second column in the datagrid):</p> <pre><code> &lt;StackPanel Margin="2"&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="All Business Processes" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Fixed Asset" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Order to Cash" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Purchase to Pay" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Stock and Make" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="General Accounting and Reporting" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;TextBlock Text=" " /&gt; &lt;/StackPanel&gt; </code></pre> <p>So far i have not been able to make this work, can anyone give me some pointers please?</p> <p>Thanks in a advance</p> <p>Dom</p> <p>EDIT Here is all my code so far: MAINPAGE.XAML</p> <pre><code> &lt;UserControl x:Class="TabControl.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="800"&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;controls:TabControl Margin="3"&gt; &lt;controls:TabItem Header="Local / Monitoring Controls" /&gt; &lt;controls:TabItem Header="IBM Controls" /&gt; &lt;controls:TabItem Header="ITAC's" &gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Grid.Row="0"&gt; &lt;Border BorderThickness="1" BorderBrush="WhiteSmoke" Background="#A1B9DD" CornerRadius="2" &gt; &lt;StackPanel Orientation="Horizontal" &gt; &lt;TextBlock Text="ITAC's - IT Automated Controls in Key Financial Systems" FontSize="12" FontWeight="Bold" Margin="5" /&gt; &lt;StackPanel Orientation="Horizontal" Margin="5"&gt; &lt;TextBlock Text="Date Last Updated: " /&gt; &lt;TextBlock Text="Test Date, needs binding" /&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;Border BorderThickness="1" BorderBrush="WhiteSmoke" Background="#A1B9DD" CornerRadius="2"&gt; &lt;TextBlock Text="ERP controls from Sirius" FontStyle="Italic" Margin="5" /&gt; &lt;/Border&gt; &lt;/StackPanel&gt; &lt;Grid x:Name="Controls" Grid.Row="1" Background="#A1AEC3"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Border Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="WhiteSmoke" Background="#A1B9DD" CornerRadius="2" Margin="1" &gt; &lt;TextBlock Text="IT Automated Controls (Europe)" FontSize="12" FontWeight="Bold" Margin="5"/&gt; &lt;/Border&gt; &lt;StackPanel Grid.Row="1" Grid.Column="0" Margin="0,0,10,0" &gt; &lt;TextBlock Text="Total Active Controls" FontWeight="Bold" Margin="5,5,5,0" TextAlignment="Right" /&gt; &lt;TextBlock Text="ITAC's Under Review" Margin="5,5,5,0" TextAlignment="Right" /&gt; &lt;TextBlock Grid.Row="3" Grid.Column="0" Text="Outstanding Issues from Previous Months" Margin="5,5,5,0" TextAlignment="Right" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" &gt; &lt;TextBox Width="200" TextAlignment="Center" Text="33" /&gt; &lt;TextBox Width="200" TextAlignment="Center" Text="5" /&gt; &lt;TextBox Width="200" TextAlignment="Center" Text="0" /&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;Grid x:Name="ITACs" Grid.Row="2" Background="#A1AEC3"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Border Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="WhiteSmoke" Background="#A1B9DD" CornerRadius="2" Margin="1" &gt; &lt;StackPanel Orientation="Horizontal" Margin="3"&gt; &lt;StackPanel Orientation="Horizontal" &gt; &lt;RadioButton GroupName="BusinessProcessTitle" /&gt; &lt;TextBlock Text="All ITAC's" FontWeight="Bold" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="100,0,0,0" &gt; &lt;RadioButton GroupName="BusinessProcessTitle" /&gt; &lt;TextBlock Text="ITAC's Requiring Review" FontWeight="Bold" /&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;Border Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" BorderThickness="1" BorderBrush="WhiteSmoke" CornerRadius="2" Margin="1" &gt; &lt;StackPanel Margin="2"&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="All Business Processes" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1" /&gt; &lt;TextBlock Text="Fixed Asset" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Order to Cash" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Purchase to Pay" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="Stock and Make" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;RadioButton GroupName="BusinessProcessesGroup" /&gt; &lt;TextBlock Text="General Accounting and Reporting" FontStyle="Italic" /&gt; &lt;/StackPanel&gt; &lt;TextBlock Text=" " /&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;Border Grid.Row="0" Grid.Column="1" BorderThickness="1" BorderBrush="WhiteSmoke" Background="#A1B9DD" CornerRadius="2" Margin="1" &gt; &lt;Grid &gt; &lt;TextBlock Text="ITAC Description" FontWeight="Bold" HorizontalAlignment="Left" Margin="3" /&gt; &lt;TextBlock Text="UL-AC1" FontStyle="Italic" HorizontalAlignment="Right" Margin="3"/&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;Border CornerRadius="2" Grid.Row="1" Grid.Column="1" BorderThickness="1" BorderBrush="WhiteSmoke"&gt; &lt;TextBlock TextWrapping="Wrap" Margin="3" Text="Based on the asset class in the master data, the ERP system automatically calculates correct amounts for depreciation at the start of the depreciation run." /&gt; &lt;/Border&gt; &lt;Border CornerRadius="2" Grid.Row="2" Grid.Column="1" BorderThickness="1" BorderBrush="WhiteSmoke"&gt; &lt;StackPanel Orientation="Horizontal" Margin="1"&gt; &lt;TextBlock Text="Issue: " Margin="3,0,0,0" /&gt; &lt;TextBlock Text="Change Request to be created - Query Update Required" /&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;Grid x:Name="MainDataGrid" Grid.Row="5" &gt; &lt;data:DataGrid x:Name="datagrid" AutoGenerateColumns="False" HorizontalAlignment="Stretch" IsReadOnly="True" VerticalAlignment="Top" ItemsSource="{Binding DataList}" Height="220" Margin="5"&gt; &lt;data:DataGrid.Columns&gt; &lt;data:DataGridTextColumn Header="#" Binding="{Binding Number}" /&gt; &lt;data:DataGridTextColumn Header="Business Process" Width="300" Binding="{Binding BusinessProcess}" /&gt; &lt;data:DataGridTextColumn Header="Sub Process" Width="300" Binding="{Binding SubProcess}" /&gt; &lt;data:DataGridTextColumn Header="ITAC" Width="100" Binding="{Binding Itac}" /&gt; &lt;data:DataGridTextColumn Header="Status" Width="200" Binding="{Binding Status}" /&gt; &lt;/data:DataGrid.Columns&gt; &lt;/data:DataGrid&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/controls:TabItem&gt; &lt;controls:TabItem Header="User Access" /&gt; &lt;controls:TabItem Header="User Provisioning" /&gt; &lt;controls:TabItem Header="About" /&gt; &lt;/controls:TabControl&gt; &lt;/Grid&gt; &lt;/UserControl&gt; MAINPAGE.XAML.CS public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this.DataContext = new ItacViewModel(); } } </code></pre> <p>DATA.CS</p> <pre><code> public class data { public int Number { get; set; } public string BusinessProcess { get; set; } public string SubProcess { get; set; } public string Itac { get; set; } public string Status { get; set; } public data(int number, string businessProcess, string subProcess, string itac, string status) { Number = number; BusinessProcess = businessProcess; SubProcess = subProcess; Itac = itac; Status = status; } } </code></pre> <p>ITACVIEWMODEL.CS</p> <p>public class ItacViewModel : ViewModelBase { public List DataList { get; set; }</p> <pre><code>public ItacViewModel() { var dataList = new List&lt;data&gt; { new data(1, "Fixed Asset", "Depreciation", "UL-AC1", "Under Review"), new data(2, "Fixed Asset", "Depreciation", "UL-AC2", "Complete"), new data(3, "Order to Cash", "Invoicing", "UL-AC3", "Under Review"), new data(4, "Order to Cash", "Shipping Goods", "UL-AC4", "Under Review"), new data(5, "Order to Cash", "Depreciation", "UL-AC5", "Complete"), new data(6, "Order to Cash", "Depreciation", "UL-AC6", "Under Review"), new data(7, "Order to Cash", "Depreciation", "UL-AC7", "Complete"), new data(8, "Stock and Make", "Depreciation", "UL-AC8", "Under Review"), new data(9, "Stock and Make", "Depreciation", "UL-AC9", "Under Review"), new data(10, "General Accounting &amp; Reporting", "Depreciation", "UL-AC10", "Complete") }; DataList = dataList; } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload