Listview - Textblock - Button - FolderBrowserDialog - ObservableCollection Binding - c#

I am trying to wrap my head around C#-wpf-MVVM.
I am attempting to put it to use with a simple idea I want to implement
.csv files stores LocationName, Location for default file locations.
.csv is read into a datatable for reference
ObservableCollection is created from datatable
Listview is bound to ObservableCollection
Textblock is bound to SelectedItem.LocationName
Button activates a FileDialogBrowser, the result of which I would like to use to update the location of the SelectedItem.LocationName
I have bound the Listview to the ObservableCollection and bound the Textblock to the SelectedItem.
Where I am running into problems is how do I get the result of the FolderDialogBrowser to update the ObservableCollection SelectedItem.LocationName?
If I change the text manually in the Textblock everything works fine...However, if I use codebehind to update the Textblock...no changes are happening.
private ObservableCollection<FileLocation > _filelocation;
private FileLocation _selectedLocation;
public ObservableCollection<FileLocation > FileLocations
{
get { return _filelocation; }
set
{
_filelocation = value;
OnPropertyChanged("Files");
}
}
public FileLocation SelectedFile
{
get { return _selectedLocation; }
set
{
_selectedLocation = value;
OnPropertyChanged("SelectedFile");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
FileLocations = new ObservableCollection<FileLocation>();
foreach (DataRow row in DtLocations.Rows)
{
string LocationDescription = (string)row.ItemArray[0];
string LocationPath = (string)row.ItemArray[1];
FileLocations.Add(new FileLocation() { LocationName = LocationDescription, Location = LocationPath });
}
<TextBox x:Name="tbxFileLocation" Tag="FileLocation" Grid.Row="1" Grid.Column="4" Width="200" Height="23" Foreground="Black" VerticalContentAlignment="Center" Text ="{Binding SelectedFile.Location ,Mode=TwoWay }" />
<Button x:Name="btnFolderLocator" Content="..." Grid.Row="1" Grid.Column="5" Width="25" Height=" 23" Background="White" HorizontalAlignment="Left" Click="BtnFolderLocator_Click" />
<ListView x:Name="lvwFileLocations" Grid.Row="9" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding FileLocations}" SelectedItem="{Binding SelectedFile }" Margin="0">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path= LocationName, Mode=TwoWay}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path= Location , Mode=TwoWay}"></TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

Related

ListBox Selected Items are reset each time I switch tabs in may TabControl

I have the following TabControl:
<TabControl Name="tabControl" Grid.Row="0" MinWidth="270" HorizontalAlignment="Stretch" ItemsSource="{Binding Counters}" ContentTemplate="{StaticResource templateForTheContent}"
ItemTemplate="{StaticResource templateForTheHeader}">
</TabControl>
It uses this DataTemplate:
<Window.Resources>
<DataTemplate x:Key="templateForTheContent" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0"
ItemsSource="{Binding}"
SelectionMode="Multiple"
BorderThickness="1" BorderBrush="#FF8B8B8B" SelectionChanged="ListBox_SelectionChanged_1">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<Run Text="{Binding CounterName, Mode=OneWay}" />
<Run Text="{Binding InstanceName, Mode=OneWay}" />
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Name="RAMSelectAllButton" Margin="0,10,0,0" Grid.Column="0" Grid.Row="1">
<TextBlock Text="SELECT ALL"/>
</Button>
<Button Name="RAMUnSelectAllButton" Margin="0,10,0,0" Grid.Column="1" Grid.Row="1">
<TextBlock Text="UNSELECT ALL"/>
</Button>
</Grid>
</DataTemplate>
<DataTemplate x:Key="templateForTheHeader" >
<TextBlock Text="{Binding CategoryName}"/>
</DataTemplate>
</Window.Resources>
It works as expected, binding works well, everything would be totally fine if this issue wasn't present:
Each time I switch a tab in my TabControl, selected items of a ListBox in my previous tab are reset - so when I go back to that tab - nothing is selected.
How to fix this?
//EDIT
here's my ListBox_SelectionChanged_1 method:
private void ListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
System.Windows.Controls.ListBox listBoxTemp = sender as System.Windows.Controls.ListBox;
PerformanceCounter counterTemp = (PerformanceCounter)listBoxTemp.Items[0];
if (!appData.SelectedCounters.ContainsKey(counterTemp.CategoryName))
appData.SelectedCounters.Add(counterTemp.CategoryName, new List<PerformanceCounter>());
appData.SelectedCounters[counterTemp.CategoryName].Clear();
foreach (PerformanceCounter counter in listBoxTemp.SelectedItems)
{
appData.SelectedCounters[counterTemp.CategoryName].Add(counter);
}
}
ListBox is bound to Counters, which is Observable Collection:
public ObservableCollection<ObservableCollection<PerformanceCounter>> Counters
{
get { return _Counters; }
}
ObservableCollection<ObservableCollection<PerformanceCounter>> _Counters = new ObservableCollection<ObservableCollection<PerformanceCounter>>();
(i am not familiar with TabControls, or WPF for that matter, but i would suggest a solution like this:)
Backup the selected items of your ListBox in a Dictionary.
var selectionBackups = new Dictionary<ListBox, IEnumerable<ListBoxItem>>();
I'd keep this field updated in ListBox_SelectionChanged_1(). Whenever you enter a Tab, overwrite the concerned ListBox's selection.
void TabEnter(object sender, TabEventArgs e)
{
ListBox lb = ... //acquire the current Listbox
OverwriteSelection(lb, selectionBackups[lb]); //set the ListBox's selection
}
(You might want to prevent the ListBox_SelectionChanged_1() from triggering when you restore the selection. That could be done like this:
bool auto_select = false; //set this to true while editing selections
private void ListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if(auto_select)
return;
...
}
)

ComboBox in WPF Datagrid c#

I have a DataGrid and fill it with a DataTable.
dgMitarbeiter.ItemsSource = mainController.loadDataTableMitarbeiter().DefaultView;
this is the function:
public DataTable loadDataTableMitarbeiter()
{
loadMitarbeiterList();
dtMitarbeiter.Clear();
foreach (Mitarbeiter mitarbeiter in mitarbeiterList)
{
drMitarbeiter = dtMitarbeiter.NewRow();
drMitarbeiter["ID"] = mitarbeiter.ID;
drMitarbeiter["Vorname"] = mitarbeiter.vorname;
drMitarbeiter["Nachname"] = mitarbeiter.nachname;
drMitarbeiter["Kostenstelle"] = mitarbeiter.kostenstelle.id;
drMitarbeiter["Größe Hose"] = mitarbeiter.gr_hose;
drMitarbeiter["Größe Oberteil"] = mitarbeiter.gr_oberteil;
drMitarbeiter["Gröse Schuhe"] = mitarbeiter.gr_schuhe;
drMitarbeiter["Ferial"] = mitarbeiter.ferial;
drMitarbeiter["Werk"] = mitarbeiter.werk;
drMitarbeiter["Datum"] = mitarbeiter.creationDate.ToString("dd.MM.yyyy");
dtMitarbeiter.Rows.Add(drMitarbeiter);
}
return dtMitarbeiter;
}
The Xaml:
<DataGrid x:Name="dgMitarbeiter" AlternatingRowBackground="Gainsboro" AlternationCount="2" ColumnWidth="*" HorizontalAlignment="Left" SelectedItem="{Binding SelectedItem}" Margin="10,22,0,0" VerticalAlignment="Top" Height="357" Width="731" CanUserAddRows="False" CanUserDeleteRows="False" RowEditEnding="dgMitarbeiter_RowEditEnding" Background="White" HeadersVisibility="Column"/>
I need a ComboBox for the column "Kostenstelle" but have no idea how to achieve this. Any ideas?
My answer implements an ObservableCollection. And adds this as a databinding to the ComboBox
You need a new class:
public class Kostenstellen: ObservableCollection<Kostenstelle>
{
}
And a fill Method with the following lines of code:
var kostenstellen = new Kostenstellen();
foreach mitarbeiter in mitarbeiterList
{
kostenstellen.Add(mitarbeiter.kostenstelle);
}
var cvsCombobox = new CollectionViewSource() { Source = this.operationList };
this.myCombobox.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = cvsCombobox });
Now there will be only "(Kostenstelle)" as a string in the Combobox.
So you need to override the ToString() method of your Kostenstelle class
public partial class Kostenstelle
{
public override string ToString()
{
return this.ID.ToString();
}
}
HINT:
Use english variable and class names next time :)
You need to define a DataGridComboBoxColumn in your DataGrid columns, you can then bind the ItemsSource to wherever your combo box's options are located.
See here.
You can do a lot in your xaml file :) For myself I used this one lately...
In the xaml file you can now define the placement of the combobox on your page.
you can set the content by code later.
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Items In Group"
TabIndex="1"
Grid.RowSpan="2"
Padding="120,126,120,50"
ItemsSource="{Binding}"
SelectionMode="None"
IsSwipeEnabled="false"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick"
>
<GridView.ItemTemplate >
<DataTemplate >
<Grid Height="150" Width="480" Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
<TextBlock Text="{Binding title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" FontSize="25"/>
<Line/>
<TextBlock Text="{Binding subtitle}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap" FontSize="20" Margin="0,10,0,0" />
<Line/>
<TextBlock Text="{Binding description}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" FontSize="15" Margin="0,10,0,0"/>
<Button Tag="{Binding title}" Click="ItemButtonClicked" Content="Details" FontSize="15" Margin="0,10,0,0"/>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemContainerStyle>
<Style TargetType="FrameworkElement" >
<Setter Property="Margin" Value="52,0,0,2"/>
</Style>
</GridView.ItemContainerStyle>
</GridView>

How to get clicked item from LongListSelector? (WP8)

I have a LongListSelector that is binded with ObservableCollection of some kind of Items. Items have many different properties.
<LongListSelector Name="DraftControl" MouseLeftButtonDown="GoToEditDraft">
<LongListSelector.ItemTemplate>
<DataTemplate>
...
</DataTemplate>
<LongListSelector.ItemTemplate>
</LongListSelector>
It has an event handler. But it gets as sender the whole LongListSelector, not a particular item. How to add event handler for all items?
Here is a handler's code:
private void GoToEditDraft(object sender, MouseButtonEventArgs mouseButtonEventArgs)
{
var clickerdItem = (LongListSelector)sender;
MessageBox.Show(clickedItem.SelectedItem.ToString());
}
So, trying to get SelectedItem this way throws NullReferenceException.
Data template:
<DataTemplate>
<Grid Margin="10" toolkit:TiltEffect.IsTiltEnabled="True">
<Grid.Background>
<SolidColorBrush Color="LightGray" Opacity="0.8"/>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition MaxHeight="100"/>
<RowDefinition MaxHeight="30"/>
</Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap" FontSize="28" Foreground="{StaticResource CustomApplicationTextBrush}" Text="{Binding Title, Converter={StaticResource SanitizeString}}" Margin="10,10,10,0" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"/>
<Image Source="/Images/no-image.png" Stretch="UniformToFill" MaxHeight="100" Margin="10,10,0,10" Grid.RowSpan="1" Grid.Column="0" Grid.Row="1" VerticalAlignment="Top"/>
<TextBlock TextWrapping="Wrap" FontSize="18" Foreground="{StaticResource CustomApplicationTextBrush}" TextTrimming="WordEllipsis" Text="{Binding Address, Converter={StaticResource SanitizeString}}" Margin="10,0,10,10" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top"/>
</Grid>
</DataTemplate>
Binding:
ObservableCollection<Item> draftItems = new ObservableCollection<Item>();
var draftStorage = IsolatedStorageFile.GetUserStoreForApplication();
IReadOnlyList<StorageFile> allDrafts = await draftFolder.GetFilesAsync();
foreach (StorageFile file in allDrafts)
{
using (var stream = new IsolatedStorageFileStream("Drafts\\" + file.Name, FileMode.Open, draftStorage))
{
var fileReader = new StreamReader(stream);
string jsonContents = fileReader.ReadLine();
Item readedItem = JsonConvert.DeserializeObject<Item>(jsonContents);
draftItems.Add(readedItem);
fileReader.Close();
}
}
DraftControl.ItemsSource = draftItems;
Try this.
private void DraftControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var myItem = ((Item)(sender as LongListSelector).SelectedItem);
}
Subscribe to LongListSelectors SelectionChangedEvent rather
<LongListSelector Name="DraftControl" SelectionChanged="lls_SelectionChanged">
<LongListSelector.ItemTemplate>
<DataTemplate>
...
</DataTemplate>
<LongListSelector.ItemTemplate>
</LongListSelector>
and get the item in the code behind
private void lls_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var myItem = ((LongListSelector) sender).SelectedItem as Type;
}

How to update ListBoxItem property

I want to update DownloadingSpeed Property which is binded to TextBox in a ListBoxItem. I am generating ListBoxItems in c#. Please guide me how do i update Binding Content of TextBoxes within a ListItemBox in C#.
WPF LisBox Code
<ListBox Width="Auto"
Name="WebsiteList"
MouseUp="SelectedListItem"
SelectedIndex="0"
Grid.Column="1"
Grid.Row="2"
Grid.RowSpan="2"
Margin="0,0,0,0">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="920">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Grid Width="920">
<TextBlock FontWeight="Bold" FontSize="18" Width="Auto">
<Hyperlink NavigateUri="http://google.com" FontStyle="Italic">
<Label Content="{Binding WebsiteTitle}" /><Label FontSize="10" Margin="0,0,0,3" Content="{Binding DirectorySize}" />
</Hyperlink>
</TextBlock>
<TextBlock Width="0" TextAlignment="right">
<TextBlock Visibility="Hidden" Text="{Binding DownloadID}"/>
<TextBlock Visibility="Hidden" Text="{Binding DirectoryPath}"/>
<TextBlock Visibility="Hidden" Text="{Binding CurrentTime}"/>
<TextBlock Visibility="Hidden" Text="{Binding CurrentDate}"/>
<TextBlock Visibility="Hidden" Text="{Binding GivenUrl}"/>
</TextBlock>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Grid Width="920">
<ProgressBar Name="progress1" Maximum="100" Minimum="0" Value="30" Background="#FFF" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=Width}" Height="10" />
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Grid Width="920">
<TextBlock HorizontalAlignment="Left" Width="Auto">Status: <TextBlock Text="{Binding Status}"/></TextBlock>
<TextBlock Width="Auto" TextAlignment="right">
<TextBlock Text="Downloading Speed: "/>
<TextBlock Name="DownloadingSpeed" Text="{Binding DownloadingSpeed}"/>
</TextBlock>
</Grid>
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
In MainWindow.xaml.cs
private void GenerateList()
{
List<Download> WebsitesList = new List<Download>();
WebsitesList.Add(new Download() {DownloadID = ID, WebsiteTitle = WebTitle, Status = WebStatus, CurrentTime = CurrentTime,CurrentDate = CurrentDate, DownloadingSpeed = DownloadSpeed, DirectoryPath = path, DirectorySize = helper.GetDirectorySize(path),GivenUrl = url });
WebsiteList.ItemsSource = WebsitesList;
}
//get download speed and update DownloadingSpeed
private void updateDownloadingSpeed(object sender, EventArgs e)
{
interfaceStats = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics();
downloadspeed = (interfaceStats.BytesReceived - previousbytesreceived) / 1024;
previousbytesreceived = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics().BytesReceived;
Download.DownloadingSpeed = Math.Round(downloadspeed, 2) + " KB/s"; //Rounding to 2 decimal places and save in DownloadSpeed Property
}
In Download.cs
public class Download : INotifyPropertyChanged
{
private string _DownloadingSpeed = "0 kb/s";
public string DownloadingSpeed
{
get { return _DownloadingSpeed; }
set
{
if (_DownloadingSpeed == value)
return;
_DownloadingSpeed = value;
this.OnPropertyChanged("DownloadingSpeed");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
Add UpdateSourceTrigger for TextBlock.
<TextBlock Name="DownloadingSpeed" Text="{Binding DownloadingSpeed, UpdateSourceTrigger=PropertyChanged}"/>
You might find that your code works if you use WPF properly by defining properties and declaring XAML correctly. It is customary to have an ObservableCollection<T> property that you data bind to the UI collection control. You would then data bind it to the ItemsSource property of the control:
<ListBox ItemsSource="{Binding Items}" ... />
Then, when you want to update any properties of the items, you need to set the properties of the items. This:
Download.DownloadingSpeed = Math.Round(downloadspeed, 2) + " KB/s";
... is not setting the property of an item from the collection. To do that, you'd need to do something like this:
// Use whatever filter you want to find the correct item from the collection
Download downloadInstance = Items.Where(d => d.Name == "SomeName").First();
downloadInstance.DownloadingSpeed = Math.Round(downloadspeed, 2) + " KB/s";

Dynamic Column headers and Header count in Datagrid WPF

I am constructing a datagrid in my WPF application.ItemSource of the Datagrid is bounded to an IEnumerable collection. I donno the ViewModel of my project. When I bind my datagrid itemsource to the datagrid I get column headers and Row values on the fly.
I donno the headers. It might be anything. I need to display detailed information of the selected row in the datagrid in a grid.
To do this i need to bing SelectedItem.HeaderName to the textblock of the grid.
But what the issue here is I donno the name of the header. So i can't simply hardcode SelectedItem.Headername.
And number of columns may differ respectively. So my detailed view should also dynamic number Header names with its respective value when a row of my datagrid is selected.
As of now i have harcoded and seen the result in my xaml like below. because for a particular file i know their respective column headers,
<Label HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Grid.Row="0"
Grid.Column="0">Header2:
</Label>
<TextBlock Grid.Row="0"
Grid.Column="1"
Name="Header2"
Text="{Binding SelectedItem.date, ElementName=dataGrid1}"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Label Grid.Row="0"
Grid.Column="2"
VerticalAlignment="Center">Header3:</Label>
<TextBlock Grid.Row="0"
Grid.Column="3"
Name="username"
Text="{Binding SelectedItem.Header3, ElementName=dataGrid1}"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Label Grid.Row="0"
Grid.Column="4"
VerticalAlignment="Center">Header4:</Label>
<TextBlock Grid.Row="0"
Grid.Column="5"
Name="level"
Text="{Binding SelectedItem.header4, ElementName=dataGrid1}"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Label Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center">Header5:</Label>
<TextBlock Grid.Row="1"
Grid.Column="1"
Name="logger"
Text="{Binding SelectedItem.header5, ElementName=dataGrid1}"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Label Grid.Row="1"
Grid.Column="2"
VerticalAlignment="Center">Headr6:</Label>
<TextBlock Grid.Row="1"
Grid.Column="3"
Name="thread"
Text="{Binding SelectedItem.header6, ElementName=dataGrid1}"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
Since i am a begginer i couldn't figure out how to do this. I will be glad if u try to help me. And suggest some concepts i need to read related to this dynamic column generation, Count, assigning dynamic column headers to other control in UI.
Thanks in advance!
I have made a small project contains dynamic generation of the grid (TextBlock + TextBox clollection) depending on DataGrid headers and object properties that made your collection in DataGrid. Hope that's what you are looking for. you can donwload it from my SkyDrive
XAML :
<Grid>
<StackPanel>
<StackPanel x:Name="myStackPanel" Orientation="Vertical"></StackPanel>
<DataGrid x:Name="myDataGrid" ItemsSource="{Binding MySource}" AutoGenerateColumns="True">
</DataGrid>
</StackPanel>
</Grid>
I have set this in Loaded event handler :
for (int i = 0; i < myDataGrid.Columns.Count; i++)
{
var childStackPanel = new StackPanel { Orientation = Orientation.Horizontal };
var myTextBlock = new TextBlock { Text = myDataGrid.Columns[i].Header + " : " };
var myTextBox = new TextBox { Width = 200 };
Type myType = typeof(Text);
IList<PropertyInfo> props = new List<PropertyInfo>(myType.GetProperties());
myTextBox.SetBinding(TextBox.TextProperty,
new Binding("SelectedItem." + props[i].Name) { ElementName = "myDataGrid" });
childStackPanel.Children.Add(myTextBlock);
childStackPanel.Children.Add(myTextBox);
myStackPanel.Children.Add(childStackPanel);
}
Text class :
public class TranslationText
{
private string _translation;
private bool _isTranslated;
public string Translation
{
get { return _translation; }
set
{
_translation = value;
}
}
public bool IsTranslated
{
get { return _isTranslated; }
set
{
_isTranslated = value;
}
}
}

Categories

Resources