code-behind

Add a list of self created web user controls to a listview in codebehind fails

邮差的信 提交于 2021-02-10 07:38:06
问题 I have a listview which I would like to fill with self created user controls.But the problem is that the properties in the user control is not set. The usercontrols are displayed but the property values I enter is not set. Why is that? Here is the aspx code. <div id="productView" class="productsMain"> <div id="groupHeader" class="productsGroupHeader"> <asp:Label ID="lblGroupHeader" runat="server" Text="Gruppe" /> </div> <asp:ListView ID="pListView" runat="server"> <LayoutTemplate> <ul class=

Handle Events in Custom Control Code Behind

泪湿孤枕 提交于 2021-01-29 13:54:50
问题 Ok, that probably is a pretty dumb question but I have searched quite a while but could not find a solution for this that works... I have a Custom control inherited from Control , which shall include code behind automation. For examble select all text of a controls TextBox when selected, or generate a list of close matches when the content of that TextBox is changed. public class vokDataGridEdit : Control { static vokDataGridEdit() { DefaultStyleKeyProperty.OverrideMetadata(typeof

Change color in part of text in textblock

蹲街弑〆低调 提交于 2021-01-27 06:23:08
问题 I need change color in code behind for part of text string.. My exaple: textblock1.Text = string1 + string2 + string3; String have dynamic values, and i want to string2 display after running the program in blue color and it must be defined in the code behind. Its possible? Thank you! 回答1: That working textblock1.Inlines.Clear(); textblock1.Inlines.Add(new Run(string1)); textblock1.Inlines.Add(new Run(string2) { Foreground = Brushes.Blue }); 回答2: I Hope that will help you: <TextBlock FontSize=

Change color in part of text in textblock

不想你离开。 提交于 2021-01-27 06:22:41
问题 I need change color in code behind for part of text string.. My exaple: textblock1.Text = string1 + string2 + string3; String have dynamic values, and i want to string2 display after running the program in blue color and it must be defined in the code behind. Its possible? Thank you! 回答1: That working textblock1.Inlines.Clear(); textblock1.Inlines.Add(new Run(string1)); textblock1.Inlines.Add(new Run(string2) { Foreground = Brushes.Blue }); 回答2: I Hope that will help you: <TextBlock FontSize=

WPF accessing scrollviewer of a listview codebehind

♀尐吖头ヾ 提交于 2021-01-27 05:27:33
问题 I need to access the scrollviewer of a listview from the codebehind. here is the definition of my listview <ListView Grid.Row="1" ItemsSource="{Binding Path=SpecList, UpdateSourceTrigger=PropertyChanged}" Name="mylistview" ItemTemplate="{StaticResource SpecElementTemplate}" Background="{StaticResource EnvLayout}" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource MyStyle}" BorderBrush="Blue"

WPF accessing scrollviewer of a listview codebehind

这一生的挚爱 提交于 2021-01-27 05:27:19
问题 I need to access the scrollviewer of a listview from the codebehind. here is the definition of my listview <ListView Grid.Row="1" ItemsSource="{Binding Path=SpecList, UpdateSourceTrigger=PropertyChanged}" Name="mylistview" ItemTemplate="{StaticResource SpecElementTemplate}" Background="{StaticResource EnvLayout}" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource MyStyle}" BorderBrush="Blue"

WPF accessing scrollviewer of a listview codebehind

不打扰是莪最后的温柔 提交于 2021-01-27 05:27:08
问题 I need to access the scrollviewer of a listview from the codebehind. here is the definition of my listview <ListView Grid.Row="1" ItemsSource="{Binding Path=SpecList, UpdateSourceTrigger=PropertyChanged}" Name="mylistview" ItemTemplate="{StaticResource SpecElementTemplate}" Background="{StaticResource EnvLayout}" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource MyStyle}" BorderBrush="Blue"

How to make HtmlSelect Control with OnChange event to trigger C# code behind function

試著忘記壹切 提交于 2020-12-25 18:41:54
问题 How should I make "Html Select Control" with OnChange event to trigger C# code behind function like ASP.NET SelectedIndexChanged of the DropDownList Control For example Front end <select runat="server" id="xx" onserverchange="xx_ServerChange"> <option>A</option> <option>B</option> <option>C</option> </select> Back End protected void xx_ServerChange(object sender, EventArgs e) { } PS: 1.Not like this Select server changed event ,because it has to make another event button. 2.Don't use asp

How to make HtmlSelect Control with OnChange event to trigger C# code behind function

梦想的初衷 提交于 2020-12-25 18:40:48
问题 How should I make "Html Select Control" with OnChange event to trigger C# code behind function like ASP.NET SelectedIndexChanged of the DropDownList Control For example Front end <select runat="server" id="xx" onserverchange="xx_ServerChange"> <option>A</option> <option>B</option> <option>C</option> </select> Back End protected void xx_ServerChange(object sender, EventArgs e) { } PS: 1.Not like this Select server changed event ,because it has to make another event button. 2.Don't use asp

Can I update the value of a WPF binding from the C# code behind?

此生再无相见时 提交于 2020-12-25 02:03:55
问题 I’m learning C# and building a UI that reads and writes integers to an XML config file. The UI uses a variety of custom user controls. I have a 3 radiobutton user control that binds to a single int variable (control returns 0,1,2). The control uses an event to trigger the update. It looks at the 3 isChecked properties to determine the new int value. But I don’t know how to update the original binding value from the code behind. It's once removed so to speak because there are two binds..one in