国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

C# wpf程序

這篇具有很好參考價(jià)值的文章主要介紹了C# wpf程序。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

--App.xaml

namespace WpfMyproject
{
? ? /// <summary>
? ? /// App.xaml 的交互邏輯
? ? /// </summary>
? ? public partial class App : PrismApplication
? ? {
? ? ? ? protected override Window CreateShell()
? ? ? ? {
? ? ? ? ? ? return Container.Resolve<MainView>();
? ? ? ? }

? ? ? ? protected override void RegisterTypes(IContainerRegistry containerRegistry)
? ? ? ? {
? ? ? ? ? ? 第二種方式
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<AutoView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<ManuView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<SetView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<ParameterView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<StatisticView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<AlarmView>();
? ? ? ? ? ? //containerRegistry.RegisterForNavigation<UserView>();
? ? ? ? }

? ? ? ? protected override IModuleCatalog CreateModuleCatalog()
? ? ? ? {
? ? ? ? ? ? return new DirectoryModuleCatalog() {ModulePath = @".\Modules" };
? ? ? ? }
? ? }
}

--MainView.xaml

?? ?<Window.Resources>
? ? ? ? <Style x:Key="MenuButtonStyle" TargetType="Button">
? ? ? ? ? ? <Setter Property="Margin" Value="5,5"/>
? ? ? ? ? ? <Setter Property="Width" Value="100"/>
? ? ? ? ? ? <Setter Property="Height" Value="60"/>
? ? ? ? ? ? <Setter Property="FontSize" Value="20"/>
? ? ? ? ? ? <Setter Property="Foreground" Value="White"/>
? ? ? ? ? ? <Setter Property="Background" Value="#666666"/>
? ? ? ? ? ? <Setter Property="VerticalAlignment" Value="Center"/>
? ? ? ? </Style>
? ? </Window.Resources>
? ? <Grid>
? ? ? ? <Grid.RowDefinitions>
? ? ? ? ? ? <RowDefinition Height="100"/>
? ? ? ? ? ? <RowDefinition/>
? ? ? ? ? ? <RowDefinition Height="60"/>
? ? ? ? </Grid.RowDefinitions>

? ? ? ? <Border Grid.Row="0" Background="#333366"/>
? ? ? ? <Border Grid.Row="2" Background="#cccccc"/>
? ? ? ? <Border Grid.Row="3" Background="Green"/>

? ? ? ? <Grid Grid.Row="0">
? ? ? ? ? ? <Grid.ColumnDefinitions>
? ? ? ? ? ? ? ? <ColumnDefinition Width="100"/>
? ? ? ? ? ? ? ? <ColumnDefinition/>
? ? ? ? ? ? ? ? <ColumnDefinition Width="200"/>
? ? ? ? ? ? </Grid.ColumnDefinitions>

? ? ? ? ? ? <StackPanel Grid.Column="0">
? ? ? ? ? ? ? ? <TextBlock Margin="0,40" Text="圖片" Width="100" FontSize="30" Foreground="Yellow" />
? ? ? ? ? ? </StackPanel>

? ? ? ? ? ? <StackPanel Grid.Column="2">
? ? ? ? ? ? ? ? <TextBlock Margin="0,20" Text="當(dāng)前登錄用戶(hù):" FontSize="18" Foreground="Purple"/>
? ? ? ? ? ? </StackPanel>

? ? ? ? ? ? <Grid Grid.Column="1">
? ? ? ? ? ? ? ? <Grid.RowDefinitions>
? ? ? ? ? ? ? ? ? ? <RowDefinition Height="40"/>
? ? ? ? ? ? ? ? ? ? <RowDefinition/>
? ? ? ? ? ? ? ? </Grid.RowDefinitions>

? ? ? ? ? ? ? ? <StackPanel Grid.Row="0">
? ? ? ? ? ? ? ? ? ? <TextBlock Margin="0,5" Text="智能控制系統(tǒng)" Width="100" FontSize="20" Foreground="White"/>
? ? ? ? ? ? ? ? </StackPanel>

? ? ? ? ? ? ? ? <StackPanel Grid.Row="1" Orientation="Horizontal">
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="自動(dòng)" Command="{Binding OpenCommand}" CommandParameter="AutoView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="手動(dòng)" Command="{Binding OpenCommand}" CommandParameter="ManuView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="設(shè)置" Command="{Binding OpenCommand}" CommandParameter="SetView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="參數(shù)" Command="{Binding OpenCommand}" CommandParameter="ParameterView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="統(tǒng)計(jì)" Command="{Binding OpenCommand}" CommandParameter="StatisticView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="報(bào)警" Command="{Binding OpenCommand}" CommandParameter="AlarmView"/>
? ? ? ? ? ? ? ? ? ? <Button Style="{StaticResource MenuButtonStyle}" Content="登錄" Command="{Binding OpenCommand}" CommandParameter="UserView"/>
? ? ? ? ? ? ? ? </StackPanel>
? ? ? ? ? ? </Grid>
? ? ? ? </Grid>

? ? ? ? <!--//第一種方式-->
? ? ? ? <!--<ContentControl Grid.Row="1" Content="{Binding Body}"/>-->
? ? ? ??
? ? ? ? <!--//第二種方式-->
? ? ? ? <ContentControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion"/>
? ? </Grid>


--MainViewModel

namespace WpfMyproject.ViewModels
{
? ? public class MainViewModel : BindableBase
? ? {
? ? ? ? //第一種方式
? ? ? ? //public DelegateCommand<string> OpenCommand { get; private set; }

? ? ? ? //public MainViewModel()
? ? ? ? //{
? ? ? ? // ? ?OpenCommand = new DelegateCommand<string>(Open);
? ? ? ? //}

? ? ? ? //private object body;
? ? ? ? //public object Body
? ? ? ? //{
? ? ? ? // ? ?get { return body; }
? ? ? ? // ? ?set { body = value; RaisePropertyChanged(); }
? ? ? ? //}

? ? ? ? //private void Open(string obj)
? ? ? ? //{
? ? ? ? // ? ?switch (obj)
? ? ? ? // ? ?{
? ? ? ? // ? ? ? ?case "AutoView": Body = new AutoView(); break;
? ? ? ? // ? ? ? ?case "ManuView": Body = new ManuView(); break;
? ? ? ? // ? ? ? ?case "SetView": Body = new SetView(); break;
? ? ? ? // ? ? ? ?case "ParameterView": Body = new ParameterView(); break;
? ? ? ? // ? ? ? ?case "StatisticView": Body = new StatisticView(); break;
? ? ? ? // ? ? ? ?case "AlarmView": Body = new AlarmView(); break;
? ? ? ? // ? ? ? ?case "UserView": Body = new UserView(); break;
? ? ? ? // ? ?}
? ? ? ? //}

? ? ? ? //第二種方式
? ? ? ? private readonly IRegionManager regionManager;

? ? ? ? public DelegateCommand<string> OpenCommand { get; private set; }

? ? ? ? public MainViewModel(IRegionManager regionManager)
? ? ? ? {
? ? ? ? ? ? OpenCommand = new DelegateCommand<string>(Open);
? ? ? ? ? ? this.regionManager = regionManager;
? ? ? ? }

? ? ? ? private void Open(string obj)
? ? ? ? {
? ? ? ? ? ? regionManager.Regions["ContentRegion"].RequestNavigate(obj);
? ? ? ? }
? ? }
}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-629331.html

到了這里,關(guān)于C# wpf程序的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶(hù)投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 你們眼睛干澀,脹痛嗎?C# WPF 久坐提醒桌面小程序 - 內(nèi)附 眼肌運(yùn)動(dòng)高清圖

    你們眼睛干澀,脹痛嗎?C# WPF 久坐提醒桌面小程序 - 內(nèi)附 眼肌運(yùn)動(dòng)高清圖

    目錄 說(shuō)明 設(shè)置提醒時(shí)間,及休息時(shí)間 久坐提醒倒計(jì)時(shí) 休息提醒倒計(jì)時(shí) 休息到計(jì)時(shí) 代碼說(shuō)明 主窗體設(shè)置 工作到計(jì)時(shí) 休息倒計(jì)時(shí) 源碼 高清圖 久坐提醒桌面小程序: 干這行職業(yè)病比較多,之前用愛(ài)麗(即:玻璃酸鈉滴眼液),用的時(shí)候挺舒服,緩解吧,不過(guò)治標(biāo)不治本。

    2024年02月14日
    瀏覽(14)
  • 你們眼睛干澀,脹痛嗎?C# WPF 久坐提醒桌面小程序 - 內(nèi)附 眼肌運(yùn)動(dòng)、遠(yuǎn)視力表高清圖

    你們眼睛干澀,脹痛嗎?C# WPF 久坐提醒桌面小程序 - 內(nèi)附 眼肌運(yùn)動(dòng)、遠(yuǎn)視力表高清圖

    目錄 說(shuō)明 設(shè)置提醒時(shí)間,及休息時(shí)間 久坐提醒倒計(jì)時(shí) 休息提醒倒計(jì)時(shí) 休息到計(jì)時(shí) 代碼說(shuō)明 主窗體設(shè)置 工作到計(jì)時(shí) 休息倒計(jì)時(shí) 源碼 高清圖 久坐提醒桌面小程序: 干這行職業(yè)病比較多,之前用愛(ài)麗(即:玻璃酸鈉滴眼液),用的時(shí)候挺舒服,緩解吧,不過(guò)治標(biāo)不治本。

    2024年02月14日
    瀏覽(16)
  • C# WPF編程-布局

    C# WPF編程-布局

    WPF窗口只能包含單個(gè)元素。為在WPF窗口中放置多個(gè)元素并創(chuàng)建更貼近實(shí)用的用戶(hù)界面,需要在窗口上放置一個(gè)容器,然后在這個(gè)容器中添加其他元素。 造成這一限制的原因是Window類(lèi)繼承自ContentControl類(lèi)。 在WPF窗口布局需要遵循以下幾條重要原則: 不應(yīng)顯示設(shè)定元素的尺寸 :

    2024年03月25日
    瀏覽(23)
  • C# WPF 數(shù)據(jù)綁定

    C# WPF 數(shù)據(jù)綁定

    后臺(tái)變量發(fā)生改變,前端對(duì)應(yīng)的相關(guān)屬性值也發(fā)生改變 接口 INotifyPropertyChanged 用于通知客戶(hù)端(通常綁定客戶(hù)端)屬性值已更改。 官方示例代碼如下 示例演示 before after 本示例提供了多種綁定方式,使用接口進(jìn)行綁定,不使用接口進(jìn)行綁定 1.在MainWindow中進(jìn)行屬性更改 2.在

    2024年02月02日
    瀏覽(16)
  • C# WPF布局

    C# WPF布局

    布局: 1、Grid: Window x:Class=\\\"WpfApp2.MainWindow\\\" ??????? 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-compatibili

    2024年04月22日
    瀏覽(28)
  • c# wpf XmlDataProvider 簡(jiǎn)單試驗(yàn)

    c# wpf XmlDataProvider 簡(jiǎn)單試驗(yàn)

    1.概要 2.代碼 3.試驗(yàn)結(jié)果

    2024年04月10日
    瀏覽(11)
  • c# wpf MultiTrigger 簡(jiǎn)單試驗(yàn)

    c# wpf MultiTrigger 簡(jiǎn)單試驗(yàn)

    1.概要 2.代碼 3.試驗(yàn)結(jié)果

    2024年04月10日
    瀏覽(20)
  • c# wpf Template ContentTemplate

    c# wpf Template ContentTemplate

    1.概要 1.1 定義內(nèi)容的外觀 2.2 要點(diǎn)分析 2.代碼 3.運(yùn)行結(jié)果

    2024年04月09日
    瀏覽(13)
  • C#學(xué)習(xí)(十)——WPF重構(gòu)與美化

    C#學(xué)習(xí)(十)——WPF重構(gòu)與美化

    特點(diǎn):【跨平臺(tái)】,【建?!?,【查詢(xún)、更改、保存】,【并發(fā)】,【事務(wù)】,【緩存】,【數(shù)據(jù)遷移】 EF的組件 項(xiàng)目延續(xù)C#學(xué)習(xí)(九)的 項(xiàng)目代碼,以此基礎(chǔ)進(jìn)行進(jìn)一步重構(gòu) 所需的NuGet包如下: 逆向數(shù)據(jù)庫(kù)獲得數(shù)據(jù)模型(Model) 首先在根目錄下創(chuàng)建Models文件夾,然后使用Tools-

    2024年01月25日
    瀏覽(20)
  • C# WPF ListBox 動(dòng)態(tài)顯示圖片

    C# WPF ListBox 動(dòng)態(tài)顯示圖片

    ? ? ? ? 最近在和其他軟件聯(lián)合做一個(gè)本地圖片選擇傳輸功能,為此希望圖片能夠有序的呈現(xiàn)在客戶(hù)端,簡(jiǎn)單的實(shí)現(xiàn)了一下功能,通過(guò)Mvvm模式進(jìn)行呈現(xiàn),過(guò)程簡(jiǎn)單通俗,話(huà)不多說(shuō)直接上圖。 ?前臺(tái)代碼 你只需要粘貼到你的前臺(tái)xml中就可以,位置記得調(diào)整下Margin,我這是按照我

    2024年02月12日
    瀏覽(32)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包