Click here to Skip to main content
15,881,424 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Enregistrer en RTF un RichTextBox / Save RTF RichTextBox Pin
Gerry Schmitz6-Aug-19 4:56
mveGerry Schmitz6-Aug-19 4:56 
QuestionListBox - Validate One or More Selections Pin
Kevin Marois22-Jul-19 9:30
professionalKevin Marois22-Jul-19 9:30 
QuestionWPF DataTemplateSelector Question Pin
Kevin Marois18-Jul-19 19:44
professionalKevin Marois18-Jul-19 19:44 
AnswerRe: WPF DataTemplateSelector Question Pin
Richard Deeming19-Jul-19 1:07
mveRichard Deeming19-Jul-19 1:07 
GeneralRe: WPF DataTemplateSelector Question Pin
Kevin Marois19-Jul-19 16:01
professionalKevin Marois19-Jul-19 16:01 
GeneralRe: WPF DataTemplateSelector Question Pin
Kevin Marois19-Jul-19 16:39
professionalKevin Marois19-Jul-19 16:39 
AnswerWPF ListBox Drag and drop Security elevation issue. Pin
Alisaunder12-Jun-19 16:13
Alisaunder12-Jun-19 16:13 
QuestionUser Control - Dependancy property MVVM Pin
MichaelLuna10-Jun-19 14:33
MichaelLuna10-Jun-19 14:33 
User Control:
1. Dropdown box of States (not all states, list from database via View Model.
2. A listbox of Counties based on state selection. The county name for county and the code for the county is what the parent forms will bind to the code for the county selection. State abbreviations will be used for both state selection and selected value.

Various forms need the user control to get state and County and bind to the database selection.
I know how to set up MVVM. And can write the VM and Model with data access.

I have not set up the view model yet
I want the user control to handle the logic of the state and county selections

here is the xaml:

<usercontrol x:class="Controls.StateCounty"
="" 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" mc:ignorable="d" d:designheight="300" d:designwidth="120">
<grid>
<stackpanel orientation="Vertical" grid.row="0" grid.column="0" grid.rowspan="3">
<textblock text="State" margin="5" horizontalalignment="Center">
<combobox x:name="StateCbx" height="20" width="50" margin="5"
="" horizontalalignment="Center" verticalcontentalignment="Center" horizontalcontentalignment="Center" itemssource="{Binding States}" selecteditem="{Binding SelectedState}">
<textblock text="County" margin="5" horizontalalignment="Center">
<listbox x:name="CountyListBox"
="" minheight="100" minwidth="100" margin="5" horizontalalignment="Center" itemssource="{Binding Counties}" selecteditem="{Binding SelectedCounty}">
<listbox.itemtemplate>
<datatemplate>
<stackpanel orientation="Horizontal">
<textblock margin="0,0,4,1" minwidth="40" text="{Binding ID}">
<textblock margin="0,0,0,1" text="{Binding Name}">










Code behind VB, but help in C# is apricated.
Namespace Controls

Public Class StateCounty

Public Property CountySelectedItem() As Object
Get
Return DirectCast(GetValue(CountySelectedItemProperty), Object)
End Get
Set
SetValue(CountySelectedItemProperty, Value)
End Set
End Property

' Using a DependencyProperty as the backing store for CountySelectedItem. This enables animation, styling, binding, etc...
Public Shared ReadOnly CountySelectedItemProperty As DependencyProperty =
DependencyProperty.Register("CountySelectedItem", GetType(Object), GetType(ListBox), New UIPropertyMetadata(Nothing))

Public Sub New()
InitializeComponent()

AddHandler CountyListBox.SelectionChanged, AddressOf CountyListBox_SelectionChanged
End Sub

Private Sub CountyListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
CountySelectedItem = CountyListBox.SelectedItem
End Sub

End Class

End Namespace


Thanks in Advance

modified 12-Jun-19 2:03am.

QuestionContentPresenter and ghost Views\ViewModels Pin
jbravofaria5-Jun-19 0:29
jbravofaria5-Jun-19 0:29 
AnswerRe: ContentPresenter and ghost Views\ViewModels Pin
Gerry Schmitz5-Jun-19 6:40
mveGerry Schmitz5-Jun-19 6:40 
GeneralRe: ContentPresenter and ghost Views\ViewModels Pin
jbravofaria5-Jun-19 9:22
jbravofaria5-Jun-19 9:22 
GeneralRe: ContentPresenter and ghost Views\ViewModels Pin
Gerry Schmitz6-Jun-19 5:47
mveGerry Schmitz6-Jun-19 5:47 
Questiondeployment size with WPF on .NET Core Pin
Super Lloyd2-Jun-19 14:47
Super Lloyd2-Jun-19 14:47 
AnswerRe: deployment size with WPF on .NET Core Pin
Mycroft Holmes2-Jun-19 16:02
professionalMycroft Holmes2-Jun-19 16:02 
GeneralRe: deployment size with WPF on .NET Core Pin
Super Lloyd2-Jun-19 16:44
Super Lloyd2-Jun-19 16:44 
GeneralRe: deployment size with WPF on .NET Core Pin
Gerry Schmitz5-Jun-19 6:49
mveGerry Schmitz5-Jun-19 6:49 
GeneralRe: deployment size with WPF on .NET Core Pin
Super Lloyd5-Jun-19 14:26
Super Lloyd5-Jun-19 14:26 
AnswerRe: deployment size with WPF on .NET Core Pin
Eddy Vluggen6-Jun-19 0:10
professionalEddy Vluggen6-Jun-19 0:10 
GeneralRe: deployment size with WPF on .NET Core Pin
Super Lloyd6-Jun-19 0:52
Super Lloyd6-Jun-19 0:52 
AnswerWPF ListBoxView Problem Pin
Alisaunder23-May-19 2:17
Alisaunder23-May-19 2:17 
AnswerRe: WPF ListBoxView Problem Pin
Gerry Schmitz23-May-19 3:31
mveGerry Schmitz23-May-19 3:31 
AnswerRe: WPF ListBoxView Problem Pin
Alisaunder23-May-19 7:19
Alisaunder23-May-19 7:19 
GeneralRe: WPF ListBoxView Problem Pin
Gerry Schmitz23-May-19 7:44
mveGerry Schmitz23-May-19 7:44 
QuestionWPF Geometry Question Pin
Kevin Marois9-May-19 9:56
professionalKevin Marois9-May-19 9:56 
AnswerRe: WPF Geometry Question Pin
Richard Deeming9-May-19 10:14
mveRichard Deeming9-May-19 10:14 

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.