Click here to Skip to main content
15,887,214 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: SelectionChanged event is not working Pin
Richard Deeming15-Oct-15 2:48
mveRichard Deeming15-Oct-15 2:48 
QuestionCheckbox IsChecked property is not binding Pin
Ashfaque Hussain14-Oct-15 2:01
Ashfaque Hussain14-Oct-15 2:01 
AnswerRe: Checkbox IsChecked property is not binding Pin
Richard Deeming14-Oct-15 2:31
mveRichard Deeming14-Oct-15 2:31 
GeneralRe: Checkbox IsChecked property is not binding Pin
Ashfaque Hussain14-Oct-15 19:32
Ashfaque Hussain14-Oct-15 19:32 
AnswerRe: Checkbox IsChecked property is not binding Pin
Meshack Musundi14-Oct-15 23:54
professionalMeshack Musundi14-Oct-15 23:54 
GeneralRe: Checkbox IsChecked property is not binding Pin
Ashfaque Hussain15-Oct-15 1:56
Ashfaque Hussain15-Oct-15 1:56 
GeneralRe: Checkbox IsChecked property is not binding Pin
Meshack Musundi15-Oct-15 3:10
professionalMeshack Musundi15-Oct-15 3:10 
QuestionWPF Binding Issue Pin
Saurabh18cs12-Oct-15 17:55
Saurabh18cs12-Oct-15 17:55 
Hello Everyone,

I am facing issue in binding data to my controls. I am not able to implement below 2 scenarios:

1) whenever i am updating my textbox text my view model is not listening the change.
2) i also want to update my other 2 textbox text property based on the value of first textbox.

Kindly help me on this one.

here is my View

<Window x:Class="iPLAN20.Windows.LS.frmLinkApplicationSite"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlnsBig Grin | :-D ="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:local="clr-namespace:iPLAN20.Model.LS"
xmlns:stb="clr-namespace:UIControls;assembly=iPLAN20UIControls"
Title="Link Information" Height="260" Width="320" Loaded="Window_Loaded" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Window.Resources>
<local:clsAppSiteLinkModel x:Key="AppSiteModel"/>
</Window.Resources>
<Grid HorizontalAlignment="Left" Name="gridLandSafeguardingLink" DataContext="{StaticResource AppSiteModel}">
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Resources\ButtonStyle.xaml"/>
<ResourceDictionary Source="..\..\Resources\textbox.xaml"/>
<ResourceDictionary Source="..\..\Resources\Common.xaml"/>
<ResourceDictionary Source="..\..\Resources\ComboBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>

<Label Content="Site No.:" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ASCIILabelStyle}" Grid.Row="0" Grid.Column="0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1">
<TextBox Text="{Binding Path=AppSiteList, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}" stb:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding AppSiteList}" AutoWordSelection="True" Width="190" Name="txtSearchAppSite" TextAlignment="Center" Margin="10,4,4,4" VerticalContentAlignment="Center" Grid.Column="1"/>
<Button IsDefault="True" x:Name="btnFind" Style="{StaticResource MetroButton}" Margin="1" Width="30" Height="30">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/IPLAN20;component/Images/Search.png" Width="12"/>
</StackPanel>
</Button.Content>
</Button>
</StackPanel>
<Label Grid.Row="1" Grid.Column="0" Style="{StaticResource ASCIILabelStyle}" Content="Choose Site:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<ComboBox Grid.Row="1" Grid.Column="1" Style="{StaticResource ComboBoxStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,4,4,4" Width="220" ItemsSource="{Binding LinkOID}"></ComboBox>

<Label Grid.Row="2" Grid.Column="0" Style="{StaticResource ASCIILabelStyle}" Content="Status:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox x:Name="txtStatus" Width="220" Grid.Row="2" Grid.Column="1" Style="{StaticResource TextBoxStyle}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,4,4,4" Text="{Binding AppSiteListColl[0].AppSiteStatus}"/>
<Label Grid.Row="3" Grid.Column="0" Style="{StaticResource ASCIILabelStyle}" Content="Description:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox x:Name="txtDescription" Height="100" Grid.Row="3" Grid.Column="1" Style="{StaticResource TextBoxStyle}" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Margin="10,4,4,4" Text="{Binding AppSiteListColl[0].AppSiteDescription}" />

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="4" Grid.Column="1">
<Button Content="Link" IsDefault="True" x:Name="btnLink" Style="{StaticResource MetroButton}"/>
<Button Content="Close" IsDefault="False" x:Name="btnCancel" Style="{StaticResource MetroButton}"/>
</StackPanel>

<!--<WindowsFormsHost>
<wf:ListBox x:Name="lstBox"/>
</WindowsFormsHost>-->

</Grid>
</Window>

and my view model

class clsAppSiteLinkModel:INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

clsLandSafeguarding objLandSafeguarding = new clsLandSafeguarding();

private ObservableCollection<string> _collAppSiteListForLink = new ObservableCollection<string>();
private ObservableCollection<clsSearchAppSiteLink> objObCollAppSiteForLink = null;
public ObservableCollection<string> AppSiteList
{
get { return _collAppSiteListForLink; }
set
{
_collAppSiteListForLink = value;
FirePropertyChanged("AppSiteList");
}
}
public ObservableCollection<clsSearchAppSiteLink> AppSiteListColl
{
get { return objObCollAppSiteForLink; }
}

private ObservableCollection<string> _collOID = new ObservableCollection<string>();
ObservableCollection<clsObjectId> objObCollOID = null;
public ObservableCollection<string> LinkOID
{
get { return _collOID; }
}

public clsAppSiteLinkModel()
{
if (iPLANConstants.Instance.Workspace == null)
{ return; }

objObCollAppSiteForLink = objLandSafeguarding.GetAppSiteForLink();

//Selecting Application site No's from MV_IPLAN_EPACS
if (objObCollAppSiteForLink != null)
{
foreach (clsSearchAppSiteLink appSiteNo in objObCollAppSiteForLink)
{
this.AppSiteList.Add(appSiteNo.AppSiteNo);
}
}

objObCollOID = objLandSafeguarding.GetNewSiteOID();
//Selecting feature OID's from file geodatabase
if (objObCollOID != null)
{
foreach (clsObjectId objctID in objObCollOID)
{
this.LinkOID.Add(objctID.ObjectIds);
}
}
}

private void FirePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}


whenever txtSearchAppSite text gets changed based on the value txtStatus and txtDescription changed their values. All data is there under objObCollAppSiteForLink observable collection and loaded(Working fine)

Thanks and Regards
QuestionRe: WPF Binding Issue Pin
Meshack Musundi13-Oct-15 20:13
professionalMeshack Musundi13-Oct-15 20:13 
AnswerRe: WPF Binding Issue Pin
Priyank612515-Oct-15 0:24
Priyank612515-Oct-15 0:24 
QuestionGet Info Pin
ASPDevloper8-Oct-15 18:47
ASPDevloper8-Oct-15 18:47 
AnswerRe: Get Info Pin
Mycroft Holmes8-Oct-15 20:26
professionalMycroft Holmes8-Oct-15 20:26 
Questionsetting image in nested menu Pin
HailStorm26-Oct-15 4:05
HailStorm26-Oct-15 4:05 
AnswerRe: setting image in nested menu Pin
Pete O'Hanlon6-Oct-15 4:30
mvePete O'Hanlon6-Oct-15 4:30 
GeneralRe: setting image in nested menu Pin
HailStorm26-Oct-15 19:26
HailStorm26-Oct-15 19:26 
GeneralRe: setting image in nested menu Pin
Pete O'Hanlon6-Oct-15 21:01
mvePete O'Hanlon6-Oct-15 21:01 
AnswerRe: setting image in nested menu Pin
Richard Deeming6-Oct-15 5:16
mveRichard Deeming6-Oct-15 5:16 
QuestionAvalon 2.0 with MVVM and 2 anchorable panes Pin
marc borgers1-Oct-15 7:10
marc borgers1-Oct-15 7:10 
QuestionNeed Some Help With This Design Pin
Kevin Marois22-Sep-15 5:42
professionalKevin Marois22-Sep-15 5:42 
SuggestionRe: Need Some Help With This Design Pin
Richard Deeming22-Sep-15 6:10
mveRichard Deeming22-Sep-15 6:10 
GeneralRe: Need Some Help With This Design Pin
Kevin Marois22-Sep-15 6:32
professionalKevin Marois22-Sep-15 6:32 
QuestionStopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs22-Sep-15 0:43
Saurabh18cs22-Sep-15 0:43 
AnswerRe: Stopping resizing of usercontrol and grid cell visibility Pin
Gerry Schmitz23-Sep-15 8:21
mveGerry Schmitz23-Sep-15 8:21 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs23-Sep-15 16:28
Saurabh18cs23-Sep-15 16:28 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Gerry Schmitz24-Sep-15 6:56
mveGerry Schmitz24-Sep-15 6:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.